1.先装了windows
2.后拿一个磁盘装linux
2.1装完centos linux后,在grub2启动选项中没有看到win启动菜单,原因是centos没有识别ntfs分区:
解决如下:
a. 添加EPEL源(ntfs-3g在该源中):
$ yum search epel
# yum install epel-release
b. 安装ntfs-3g用于识别ntfs分区:
# yum install ntfs-3g(ntfs-3g.x86_64)
c. 重新生成引导项:(即运行update-grub2)
# grub2-mkconfig -o /boot/grub2/grub.cfg
cat update-grub2
#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"
其他相关:
如果是三系统,第一个装的是windows,第二个是centos, 第三个ubuntu,我的做法是装第三个系统前先删除第二个系统的boot,由第三个系统来装新的boot,更新update-grub2后能识别出三个系统。
[root@localhost grub.d]# ls /etc/grub.d
00_header 01_users 20_linux_xen 30_os-prober 41_custom
00_tuned 10_linux 20_ppc_terminfo 40_custom README
grub> ls
grub> set
在grub-rescue下:
set root=hd1,msdos8
set prefix=(hd1,msdos8)/boot/grub
insmod normal
normal
进入linux,打开控制台,更新grub
sudo update-grub2
grub设置默认启动项:
使用“sudo vim /etc/default/grub”命令打开该配置文件。
其中的“GRUB_DEFAULT=0”就是设置的默认启动项了。GRUB启动项是按照启动菜单依次使用数字进行索引了,起始数字为0。结合前面的系统启动菜单,如Windows8的启动项在第5项,因此这里我们就需要修改为4(因为第一项是从0开始的)。