windows-linux(centos7)双系统-引导修复

这是我安装的centos版本 :CentOS-7-x86_64-DVD-1908.iso。

安装完双系统后发现开机引导界面只有linux项,我们需要在linux的引导菜单中加入windows的引导。

如果要修改引导顺序请参考:https://www.cnblogs.com/dch0/p/11818760.html

添加windows引导方法一(推荐)

1.root身份编辑40_custom

vi /etc/grub.d/40_custom
#执行结果如下,在最后一行添加windows引导:
#!/bin/sh exec tail -n +3 $0 # 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'{ set root=(hd0,1) chainloader +1 }

hd0表示硬盘,1表示c盘,
我的windows安装在硬盘的第一个分区,所以此处是 set root=(hd0,1),根据实际情况修改

2.生成gurb.cfg文件

grub2-mkconfig -o /boot/grub2/grub.cfg

然后reboot重启,就可以看到windows的引导项了。

添加windows引导方法二

1.编辑grub.cfg

vi /boot/grub2/grub.cfg

打开后,定位到这段,

### BEGIN /etc/grub.d/40_custom ###
# 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.
### END /etc/grub.d/40_custom ###

在 ### END /etc/grub.d/40_custom ### 前一行插入

menuentry 'Windows 10'{
set root=(hd0,1)
chainloader +1
}

保存重启即可。

原文地址:https://www.cnblogs.com/dch0/p/11818576.html