在一台服务器上安装centos双系统,一个6.4一个6.3,安装完毕需要更改grub引导,针对这个问题做一下总结,与各位分享。
在/etc和/boot/grub下都存在grub.conf文件,/etc下的grub文件是/boot/grub下grub文件的硬链接,所以改任何一个都可以。
default=2 : 制定启动的内核,从编号0开始
splashimage=(hd2,0)/boot/grub/splash.xpm. gz
\\ CentOS 在启动的时候背景是有色彩变化的, 就是这个文件提供的背景图示
root (hd0,0):
root :代表的是『核心文件放置的那个 partition 而不是根目录』喔!不要搞错了!
(hd0,0): 硬盘代号以小括号 ( ) 包起来;
硬盘以 hd 表示,后面会接一组数字;
以『搜寻顺序』做为硬盘的编号,而不是依照硬盘排线的排序!(这个重要!)
第一个搜寻到的硬盘为 0 号,第二个为 1 号,以此类推;
每颗硬盘的第一个 partition 代号为 0 ,依序类推。
上面标红的部分建议像上面几个title一样使用硬盘的uuid,防止因磁盘设备(sda,sdb,sdc….)变化印发的问题。
(注:获取uuid的方法:ls -la /dev/disk/by-uuid)
在/etc和/boot/grub下都存在grub.conf文件,/etc下的grub文件是/boot/grub下grub文件的硬链接,所以改任何一个都可以。
点击(此处)折叠或打开
- # grub.conf generated by anaconda
- #
- # Note that you do not have to rerun grub after making changes to this file
- # NOTICE: You do not have a /boot partition. This means that
- # all kernel and initrd paths are relative to /, eg.
- # root (hd2,0)
- # kernel /boot/vmlinuz-version ro root=/dev/sdb1
- # initrd /boot/initrd-[generic-]version.img
- #boot=/dev/sdd
- default=2
- timeout=5
- #centos6.4
- splashimage=(hd2,0)/boot/grub/splash.xpm.gz
- #centos6.3
- #splashimage=(hd0,0)/grub/splash.xpm.gz
- hiddenmenu
- title CentOS (3.10.58)
- root (hd2,0)
- 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
- initrd /boot/initramfs-3.10.58.img
- title CentOS (2.6.32)
- root (hd2,0)
- 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
- initrd /boot/initramfs-2.6.32.img
- title CentOS (2.6.32-358.el6.x86_64)
- root (hd2,0)
- 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
- initrd /boot/initramfs-2.6.32-358.el6.x86_64.img
- title CentOS (2.6.32-279.el6.x86_64)
- root (hd0,0)
- 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
- initrd /initramfs-2.6.32-279.el6.x86_64.img
splashimage=(hd2,0)/boot/grub/splash.xpm. gz
\\ CentOS 在启动的时候背景是有色彩变化的, 就是这个文件提供的背景图示
root (hd0,0):
root :代表的是『核心文件放置的那个 partition 而不是根目录』喔!不要搞错了!
(hd0,0): 硬盘代号以小括号 ( ) 包起来;
硬盘以 hd 表示,后面会接一组数字;
以『搜寻顺序』做为硬盘的编号,而不是依照硬盘排线的排序!(这个重要!)
第一个搜寻到的硬盘为 0 号,第二个为 1 号,以此类推;
每颗硬盘的第一个 partition 代号为 0 ,依序类推。
上面标红的部分建议像上面几个title一样使用硬盘的uuid,防止因磁盘设备(sda,sdb,sdc….)变化印发的问题。
(注:获取uuid的方法:ls -la /dev/disk/by-uuid)