|
一般情况下,装了ubuntu后再装rhel,rhel就会把ubuntu的grub覆盖
当你重启时引导里就再没有ubuntu了。那么则样才能让ubuntu与rhel共
用一个grub,实现ubuntu与rhel的双系统呢。在鄙人研究了一天后,终
于想明白了,并且在多台机子上实验成功,先面就向大家分享一下我的方
法,如哪里有不妥之处还望指正,支持开源,谢谢!
首先在你当前的rhel上找到ubuntu的boot分区,
使用命令
:/> fdisk -l
查看盘符,找到ubuntu的boot分区后,将其挂在到一个文件夹下(也可以
用图形disk工具查看,会更方便)
:/> mount /dev/sda*(具体的盘符) /mnt
然后进到grub里找到grub.cfg,用vi编辑器查看
:/> vi /mnt/grub/grub.cfg
找到进入ubuntu系统的那个menuentry,并拷贝下来
menuentry 'Ubuntu, with Linux 2.6.38-13-generic' --class
ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos5)'
search --no-floppy --fs-uuid --set=root b565a684-
9df3-4488-a6fc-ee328e3cfe1d
linux /vmlinuz-2.6.38-13-generic root=UUID=c871
eb5d-8905-488e-8b3a-8d8a3b63cf22 ro quiet splash vt.han
doff=7
initrd /initrd.img-2.6.38-13-generic
}
然后进入rhel的grub里
:/> cd /boot/grub/grub.conf
把复制的ubuntu11的引导粘贴到最后一行,并作如下修改,使之可以被rhel6
识别。(ubuntu 默认启动分区时他的引导分区boot,我的分区时sda5,因此
引导写的是 “root (hd0,4)”)。
default=0
timeout=5
splashimage=(hd0,2)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-71.el6.x86_64)
root (hd0,2)
kernel /vmlinuz-2.6.32-71.el6.x86_64 ro root=/dev/
mapper/vg_instructor-LogVol01 rd_LVM_LV=vg_instructor/LogV
ol01 rd_LVM_LV=vg_instructor/LogVol00 rd_NO_LUKS rd_NO_MD
rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOA
RDTYPE=pc KEYTABLE=us crashkernel=128M rhgb quiet
initrd /initramfs-2.6.32-71.el6.x86_64.img
title Other
rootnoverify (hd0,0)
chainloader +1
title Ubuntu Linux (2.6.38-8-generic)
root (hd0,4)
kernel /vmlinuz-2.6.38-8-generic ro root=UUID=c871
eb5d-8905-488e-8b3a-8d8a3b63cf22 quiet splash vt.handoff=7
initrd /initrd.img-2.6.38-8-generic
保存退出
:/> wq!
亲!下来就可以重启,感受一下了!
:/> reboot |
|
|