安装Windows 7后,再安装CentOS 7,重新启动,发现Windows 7启动项消失了。
原因:CentOS 7 默认不支持ntfs分区,无法读取 windows 7 的 引导程序。
1. 修复方法一(推荐):
安装 ntfs-3g 用于识别ntfs分区
首先用yum search查找ntfs包
#yum search ntfs
已加载插件:fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
============================== N/S matched: ntfs ===============================
ntfs-3g.x86_64 : Linux NTFS userspace driver
ntfs-3g-devel.x86_64 : Development files and libraries for ntfs-3g
ntfsprogs.x86_64 : NTFS filesystem libraries and utilities
然后安装epel-release
# yum install epel-release
已加载插件:fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 升级
---> 软件包 epel-release.noarch.0.7-12 将被 更新
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在更新:
epel-release noarch 7-12 epel 15 k
事务概要
================================================================================
升级 1 软件包
总下载量:15 k
Is this ok [y/d/N]: y
Downloading packages:
epel/x86_64/prestodelta | 1.0 kB 00:00
epel-release-7-12.noarch.rpm | 15 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : epel-release-7-12.noarch 1/2
清理 : epel-release-7-11.noarch 2/2
验证中 : epel-release-7-12.noarch 1/2
验证中 : epel-release-7-11.noarch 2/2
更新完毕:
epel-release.noarch 0:7-12
完毕!
安装ntfs-3g
shell
# yum install ntfs-3g.x86_64
已加载插件:fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 ntfs-3g.x86_64.2.2017.3.23-11.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
ntfs-3g x86_64 2:2017.3.23-11.el7 epel 265 k
事务概要
================================================================================
安装 1 软件包
总下载量:265 k
安装大小:612 k
Is this ok [y/d/N]: y
Downloading packages:
ntfs-3g-2017.3.23-11.el7.x86_64.rpm | 265 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : 2:ntfs-3g-2017.3.23-11.el7.x86_64 1/1
验证中 : 2:ntfs-3g-2017.3.23-11.el7.x86_64 1/1
已安装:
ntfs-3g.x86_64 2:2017.3.23-11.el7
完毕!
重新生成引导项
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1062.4.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.4.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-48b8fac2a2c24724a135e690a4776799
Found initrd image: /boot/initramfs-0-rescue-48b8fac2a2c24724a135e690a4776799.img
Found Windows 7 (loader) on /dev/sda1
done
修复方法二:
进入su模式,修改grub.cfg
# su
密码:
#vim /boot/grub2/grub.cfg
找到 ### BEGIN /etc/grub.d/30_os-prober ###
然后添加:
menuentry "Windows 7" {
set root='(hd0,1)'
chainloader +1
}
注意,hd0表示系统第一块硬盘,1表示C分区,根据实际情况修改。
然后执行下面的命令,
# grub2-mkconfig -o /boot/grub2/grub.cfg
然后重新启动机器。