Chinaunix首页 | 论坛 | 博客
  • 博客访问: 420488
  • 博文数量: 122
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 688
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-04 12:30
文章分类

全部博文(122)

文章存档

2017年(5)

2016年(4)

2015年(56)

2014年(41)

2013年(16)

我的朋友

分类: LINUX

2014-12-24 19:11:49

今天因工作需要,在一台服务器上安装centos双系统,一个6.4一个6.3,安装完毕需要更改grub引导,针对这个问题做一下总结,与各位分享。
/etc和/boot/grub下都存在grub.conf文件,/etc下的grub文件是/boot/grub下grub文件的硬链接,所以改任何一个都可以。

点击(此处)折叠或打开

  1. # grub.conf generated by anaconda
  2. #
  3. # Note that you do not have to rerun grub after making changes to this file
  4. # NOTICE: You do not have a /boot partition. This means that
  5. # all kernel and initrd paths are relative to /, eg.
  6. # root (hd2,0)
  7. # kernel /boot/vmlinuz-version ro root=/dev/sdb1
  8. # initrd /boot/initrd-[generic-]version.img
  9. #boot=/dev/sdd
  10. default=2
  11. timeout=5
  12. #centos6.4
  13. splashimage=(hd2,0)/boot/grub/splash.xpm.gz
  14. #centos6.3
  15. #splashimage=(hd0,0)/grub/splash.xpm.gz
  16. hiddenmenu
  17. title CentOS (3.10.58)
  18.     root (hd2,0)
  19.     kernel /boot/vmlinuz-3.10.58 ro root=UUID=eefa4f2d-a3ca-47a1-a292-40a68241c66b rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=128M KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
  20.     initrd /boot/initramfs-3.10.58.img
  21. title CentOS (2.6.32)
  22.     root (hd2,0)
  23.     kernel /boot/vmlinuz-2.6.32 ro root=UUID=eefa4f2d-a3ca-47a1-a292-40a68241c66b rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=128M KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
  24.     initrd /boot/initramfs-2.6.32.img
  25. title CentOS (2.6.32-358.el6.x86_64)
  26.     root (hd2,0)
  27.     kernel /boot/vmlinuz-2.6.32-358.el6.x86_64 ro root=UUID=eefa4f2d-a3ca-47a1-a292-40a68241c66b rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=128M KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
  28.     initrd /boot/initramfs-2.6.32-358.el6.x86_64.img
  29. title CentOS (2.6.32-279.el6.x86_64)
  30.     root (hd0,0)
  31.     kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/mapper/vg_centos6-lv_root nomodeset rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_centos6/lv_swap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=1024M rd_LVM_LV=vg_centos6/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
  32.     initrd /initramfs-2.6.32-279.el6.x86_64.img
default=2 : 制定启动的内核,从编号0开始
splashimage
=(hd2,0)/boot/grub/splash.xpm.gz  
            \\
CentOS 在启动的时候背景是有色彩变化的,就是这个文件提供的背景图示
root (hd0,0): 
           
root :代表的是『核心文件放置的那个 partition 而不是根目录』喔!不要搞错了!
            (hd0,0): 硬盘代号以小括号 ( ) 包起来;
                      硬盘以 hd 表示,后面会接一组数字;
                      以『搜寻顺序』做为硬盘的编号,而不是依照硬盘排线的排序!(这个重要!)
                      第一个搜寻到的硬盘为 0 号,第二个为 1 号,以此类推;
                      每颗硬盘的第一个 partition 代号为 0 ,依序类推。
上面例子中0、1、2装在一个地方,所以我的机器只能引导2进入系统,其余两个被覆盖(现象是这样,但不确定是这个原因)。

上面标红的部分建议像上面几个title一样使用硬盘的uuid,防止因磁盘设备(sda,sdb,sdc….)变化印发的问题。
            (注:获取uuid的方法:ls -la /dev/disk/by-uuid)

       





阅读(1222) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~