记录一下更改系统启动菜单的方法。vim
前提:ide
1. 先安装 Win7 在硬盘第一分区,其它分区在 Win7 下处于未分配状态。this
2. 再安装 CentOS 到上述未分配分区。(注意:手动分区时,能够留必定空间,最后格式化为 vfat,用以在 Win7 和 CentOS 之间共享数据。)spa
安装完后,发现开机菜单只有 CentOS,而没有 Win7 选项了。使用如下步骤解决:code
打开文件:blog
# vim /etc/grub.d/40_custom
在最后加入 ( 注意,由于个人 Win7 在硬盘第一分区,因此这里是 (hd0,1) ):class
#!/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 }
修改启动菜单的读秒时间,打开文件:配置
# vim /etc/default/grub
修改读秒时间为 30 秒:file
GRUB_TIMEOUT=30
从新配置 grub2:方法
# grub2-mkconfig -o /boot/grub2/grub.cfg
重启便可。