centos7添加win7启动引导方法

来源:互联网 发布:域名到期抢注 编辑:程序博客网 时间:2024/05/17 05:13

centos7添加win7启动引导方法

在win7上装完centos7的小伙伴们,一般都会遇到个问题就是win7启动不了了。
1、vim /boot/grub2/grub.cfg
2、找到  ### BEGIN /etc/grub.d/30_os-prober ###,在后面添加

[plain] view plain copy
  1. menuentry "Windows 7" {  
  2.      insmod ntfs  
  3.      set root=(hd0,1)  
  4.      chainloader +1  
  5. }  

(grub2从1计数,win7装在C盘上的可以在终端里输入 fdisk -l来确定下,一般win都是装在C的吧)

3、wq! 

4、reboot(重启之后会在启动页面第三行字符出现windos7,选中,按回车,OK!!);


但是这个文件是不推荐直接手动改的,因为系统更新会执行grub更新操作,这个文件就会被刷新,添加的内容就没了

所以,我们这样做下处理:

1、cd /etc/grub.d

2、vim 40_custom

写入以下内容

[plain] view plain copy
  1. #!/bin/sh  
  2. exec tail -n +3 $0  
  3. # This file provides an easy way to add custom menu entries.  Simply type the  
  4. # menu entries you want to add after this comment.  Be careful not to change  
  5. # the 'exec tail' line above.  
  6. menuentry 'Windows7'{  
  7. set root=(hd0,1)  
  8. chainloader +1  
  9. }  

3、再刷进boot下的文件:  grub2-mkconfig -o /boot/grub2/grub.cfg

原创粉丝点击