so、修改这个文件虽然可以达到效果,但是在系统执行grub2-mkconfig之后你修改的配置就会失效。
所以,我们要去修改模版文件,然后执行 grub2-mkconfig 自动重建grub2引导。
$ sudo vi /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 'Windows7'{
set root=(hd0,1)
chainloader +1
}
$ grub2-mkconfig -o /boot/grub2/grub.cfg
$ reboot
注意,grub2中第一块磁盘的第一个分区是(hd0,1),而不是(hd0,0),这一点跟grub有稍许不同,还有不要自作聪明的改sda什么的。。。
转载:http://www.ruesin/system/centos/centos7-grub2-193.html
更详细请参考 http://blog.sina/s/blog_5a6dca940102vsxr.html