這是我安裝的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 }
保存重啟即可。