参照博客https://blog.youkuaiyun.com/u012418573/article/details/79607247
https://www.cnblogs.com/focus-g/p/11355350.html
一、添加引导win7:
$ 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
}
其中hd0,1指第一块磁盘的,第1个分区,即C盘
修改默认win7引导
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,也不会生效。
注:若以上方法不行,可以采用以下方法,亲测可行(windows 7+centos 7.5 ,Legacy boot安装)
sudo yum -y install epel-release
sudo yum -y install ntfs-3g
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
然后在重启电脑,你就会发现window启动项出现了
挂载NTFS
为了能让Linux服务器能够识别NTFS的移动硬盘,就必须安装ntfs-3g(Third Generation Read/Write NTFS Driver)的包。
官方网址:http://www.tuxera.com/,
文档手册:http://www.tuxera.com/community/ntfs-3g-manual/
下载地址:http://www.tuxera.com/community/ntfs-3g-download/
方法一:(推荐)
sudo yum -y install ntfs-3g(需安装EPEL源)
安装完后就自动挂载ntfs盘了
方法二:
骤一:解压安装NTFS-3G。
tar -xvzf ntfs-3g_ntfsprogs-2012.1.15.tgz
cd ntfs-3g_ntfsprogs-2012.1.15
执行安装过程如下所示:
./configure
make
make install
之后系统会提示安装成功,下面就可以用ntfs-3g来实现对NTFS分区的读写。
实现自动挂载
(1)新增文件
# vi /sbin/mount.ntfs
内容如下:
#!/bin/bash
export LANG=en_US.UTF-8
exec /sbin/mount.ntfs-3g "$@"
(2)增加执行权限:
# chmod a+x /sbin/mount.ntfs
至此,可以看到win7下的ntfs盘符可以访问了,插上ntfs 移动磁盘也能自己挂载了。