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"

4.
root執行將需要的選項設爲默認值
grub2-set-default “Windows 10”(我怕打錯,直接複製)
執行
grub2-editenv list 查看結果

saved_entry=Windows 10

好了哦。
學習的記錄,,,

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章