如何在CentOS 8/RHEL 8上将Windows 10引导项添加到GRUB
时间:2020-03-21 11:49:12 来源:igfitidea点击:
GRUB(GRand统一引导加载程序),是基于RHEL的EL发行版的默认引导加载程序。
将所有系统与基于RHEL的EL发行版一起安装时,通过Microsoft Windows 10进行相应的双重引导。
将Windows 10引导菜单添加到基于RHEL的EL发行版中相应的基于GRUB的引导程序中。
我们需要按照以下给定教程的每个步骤进行操作。
步骤1(检查Windows 10可引导NTFS分区)
# fdisk -l
输出示例
Disk /dev/sda: 250.1 GB, 250059350016 bytes, 488397168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes/512 bytes I/O size (minimum/optimal): 512 bytes/512 bytes Disk label type: dos Disk identifier: 0x6b07969f Device Boot Start End Blocks Id System /dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT /dev/sda2 206848 143566847 71680000 7 HPFS/NTFS/exFAT /dev/sda3 426172416 488393119 31110352 7 HPFS/NTFS/exFAT /dev/sda4 143566910 426172319 141302705 f W95 Ext'd (LBA) /dev/sda5 143566912 365514751 110973920 7 HPFS/NTFS/exFAT /dev/sda6 365527008 426172319 30322656 7 HPFS/NTFS/exFAT Partition table entries are not in disk order
其中我们可以看到可引导驱动器“/dev/sda1”前面的“ *”
注意:其中我们需要注意Windows 10的可启动驱动器。
在本教程中,Windows 10的可启动驱动器是/dev/sda1.
步骤2(将Windows 10启动项目添加到基于RHEL的EL)
# vim /etc/grub.d/40_custom
在文件中添加以下几行,并将'/dev/sda1'替换为安装点。
#!/bin/sh exec tail -n +3# grub2-mkconfig --output=/boot/grub2/grub.cfg# This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry "Windows 10 (loader) (on /dev/sda1)" { insmod part_msdos insmod ntfs set root='(hd0,msdos1)' chainloader +1 } menuentry 'Windows 10 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-8EC01928C0191853' { insmod part_msdos insmod ntfs set root='hd0,msdos1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 8EC01928C0191853 else search --no-floppy --fs-uuid --set=root 8EC01928C0191853 fi parttool ${root} hidden chainloader +1 }
保存并退出':wq!'
步骤3(更新GRUB2引导加载程序)
Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-b292a5b69a2343149ed86f7e6fe782c8 Found initrd image: /boot/initramfs-0-rescue-b292a5b69a2343149ed86f7e6fe782c8.img Found Windows 10 (loader) on /dev/sda1 done
输出示例
# systemctl reboot
步骤4(重新启动系统以检查状态)
##代码##现在我们已成功将Window s10引导项添加到RHEL和CentOS上的GRUB引导管理器中。