CentOs 7 下修改 Windows 默认启动顺序

#修复引导win 10(或Windows 7等):
1、增加windows启动 菜单
root权限执行:
$ sudo vim /etc/grub.d/40_custom
得到打开文件后并编辑

#!/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
}
~
~

按Esc,在按ZZ(或者Shift+:并输入wq),保存编辑并退出。
括号内的hd0为第一启动顺序硬盘 。如果是第二块硬盘则为hd1…
括号内的1为第一分区。如果是第二分区则为 2…
例子:如果第二块硬盘的第二分区 (hd1,2)
#插入一条啊
vim /etc/default/grub
GRUB_TIMEOUT=35 默认5秒,插入一个3,改成35秒,这样有时间选择
2、root执行:
grub2−mkconfig −o /boot/grub2/grub.cfg生成grub.cfg文件。
执行: reboot
重启既可以看到为windows 10的引导了。
3.查看有那些菜单项
cat /boot/grub2/grub.cfg | grep menuentry

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="–id"
menuentry_id_option=""
export menuentry_id_option


menuentry “Windows 10”
这里的值也许是’Windows Boot Manager …
反正就是它了

4.
root执行将需要的选项设为默认值
grub2-set-default "Windows 10"
执行
grub2-editenv list 查看结果

saved_entry=Windows 10

好了哦。
学习的记录,,,

猜你喜欢

转载自blog.csdn.net/linuing/article/details/81910264