centos7下修改windows默认启动顺序

转载地址:http://blog.csdn.net/q260864798/article/details/53502242
方法一(亲试有效)
一、修复引导win7:
1、执行:
$ sudo vim /etc/grub.d/40_custom
得到打开文件后,执行a进行编辑,

#!/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 7'{
set root=(hd0,1)
chainloader +1
}
~
~
~
~
~
~
~
"/etc/grub.d/40_custom" 9L,272C

按Esc,在按ZZ(或者Shift+:并输入wq),保存编辑并退出。
2、执行:
g r u b 2 m k c o n f i g o / b o o t / g r u b 2 / g r u b . c f g g r u b . c f g 3 : reboot
重启既可以看到为windows10的引导了。

二、修改引导顺序:
1. sudo vim /etc/default/grub
注释掉GRUB_DEFAULT=saved,在这一行的下面插入GRUB_DEFAULT=’Windows 7’,保存并退出。然后执行
下面的命令
2. sudo grub2-mkconfig –output=/boot/grub2/grub.cfg 上面这句命令不能省,因为此命令是重新生成/boot/grub2/grub.cfg,否则就算改了/etc/default/grub,也不会生效。

方法二(没态看明白,随便测试了一下,没有收到效果)

一、修复引导win10:
1.使用root身份(必须)打开 /boot/grub2/grub.cfg
2.找到 ### BEGIN /etc/grub.d/30_os-prober ###
在后面添加

menuentry 'Windows 7' {
insmod ntfs
set root=(hd0,2)
chainloader +1
}

说明:set root=(hd0,1) 其中 hd0 表示硬盘,1表示C盘 ,我的win10装在C盘,它是sda1
3.保存重启

二、修改引导顺序:
# grub2-set-default ‘Windows 7’ 验证默认启动项:
# grub2-editenv list
输出:

猜你喜欢

转载自blog.csdn.net/u012418573/article/details/79607247