CentOS7引导的更新与管理

最近新装了CentOS7,很多地方都不一样了。先装了windows7再装linux发现windows不能自动识别出来,只能到linux下修改了。

1.首先登入root账户,进入/boot/grub2中查看文件,(grub2和CentOS6用的grub不太一样,以前的方法已经不管用了)。

2.使用gedit grub.cfg打开文件,grub.cfg可以说是centos7的引导配置文件,看下面

这个文件是用模板/etc/grub.d和设置/etc/default/grub生成的。既然是生成的,那就有命令可以再重新生成引导。

3.进入目录 ls /sbin查到类似命令grub2-mkconfig,试了一下生成内容和grub.cfg大体相同。用man grub2-mkconfig查询命令的用法,得到如下解释:

4.现在开始生成。首先保存原始文件,用命令cp grub.cfg grub.cfg.bak ,然后依照3中提示打入命令grub2-mkconfig -o /boot/grub2/grub.cfg,如下图所示

现在重新启动一下,发现引导没有改变。继续


5.在/sbin里发现一个命令grub2-install,用man查询一下用法,之后键入命令grub2-install /dev/sda。


好了,下面要把windows设置成默认启动项。

先找到/etc/grub.d中,看README写了什么(这里我就不翻译了)

All executable files in this directory are processed in shell expansion order.

  00_*: Reserved for 00_header.
  10_*: Native boot entries.
  20_*: Third party apps (e.g. memtest86+).

The number namespace in-between is configurable by system installer and/or
administrator.  For example, you can add an entry to boot another OS as
01_otheros, 11_otheros, etc, depending on the position you want it to occupy in
the menu; and then adjust the default setting via /etc/default/grub.

再看看我的文件夹里都有什么文件


试一下把30_os-prober修改成01_os-prober,命令为mv 30_os-prober 01_os-prober,再重新生成grub2.cfg文件,发现windows启动项已经排到前面了


参考资料:http://blog.sina.com.cn/s/blog_64d57e710100mjuk.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值