[PLUG] Can one add an OS on a second drive to GRUB
Brian Martin
plugng3 at martinconsulting.com
Tue Feb 12 20:55:07 UTC 2013
> In my "new" machine I have a disk with both XP and 64 bit Ubuntu
12.04. I have a second disk with 32 bit Ubuntu
> 12.04. So far I have swapped cables when I wanted to do something
with the 32 bit version. Is it possible to have
> both drives plugged in at the same time and have GRUB give me the
option of which of the three OS's to boot? If
> it matters, these are both SATA drives
Sure. If you're using (legacy) Grub, you'll need to add an entry in
/boot/grub/device.lst for the additional device, and the appropriate
entries in /boot/grub/menu.lst. Here is a sample device.map:
device.map:
(hd0) /dev/sda
(hd1) /dev/sdb
The (hd0) entry will already be there, an I added (hd1).
Then just copy the relevant entry from the menu.lst file on your second
disk into /boot/grub/menu.lst on your first disk, but change the hd0
entries to hd1. Here's one of mine, showing both the existing (hd0)
entry, and the new (hd1) entry:
title Desktop -- openSUSE 12.1 - 3.1.10-1.16 - hd0
root (hd0,0)
kernel /boot/vmlinuz-3.1.10-1.16-desktop root=/dev/md1 resume=/dev/md2
splash=silent showopts init=/sbin/sysvinit ipv6.disable=1 vga=0x31a
initrd /boot/initrd-3.1.10-1.16-desktop
title Desktop -- openSUSE 12.1 - 3.1.10-1.16 - hd1
root (hd1,0)
kernel /boot/vmlinuz-3.1.10-1.16-desktop root=/dev/md1 resume=/dev/md2
splash=silent showopts init=/sbin/sysvinit ipv6.disable=1 vga=0x31a
ipv4only=1
initrd /boot/initrd-3.1.10-1.16-desktop
In my case they're both the same kernel, devices, etc., but they could
just as easily be drastically different (even Linux and Windows).
---
If you're using GRUB2, boot up with both disks plugged in, and run
update-grub2. It should discover that the second disk is bootable (too),
and add it to the menu. Here's an example:
# update-grub2
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-37-generic
Found initrd image: /boot/initrd.img-3.2.0-37-generic
Found linux image: /boot/vmlinuz-3.2.0-36-generic
Found initrd image: /boot/initrd.img-3.2.0-36-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Ubuntu 12.04.2 LTS (12.04) on /dev/sda2
Found Ubuntu 12.04.2 LTS (12.04) on /dev/sdb2
done
#
Notice that in addition to the primary image (which in my case is an
RAID device), it also found bootable systems on both /dev/sda2 and
/dev/sdb2. In my case those are really the mirror images from the RAID,
but they wouldn't need to be.
Good luck.
-Brian
More information about the PLUG
mailing list