External drive booting

Q I am new to Linux and am exploring all the distros. I have XP dual booted with Ubuntu and I then added a second drive installing SUSE 10.3 on to that. The Ubuntu install created a boot menu including Windows, and when I installed SUSE it installed its own boot menu listing both Windows and Ubuntu. When selecting Ubuntu from the SUSE menu I am returned to Ubuntu menu, which works as before. I now want to boot into a 250GB USB drive holding PCLinuxOS. When I tried a direct install of PCLinuxOS, it installed its own boot menu which deleted the SUSE menu and only listed PCLinuxOS and Windows.

Is there an easy way to add OSes on the external drive to the SUSE boot menu or quickly create a new one to include all OSes, so as to boot any selected partition internal or external? I am not very good with the command line having just migrated from Windows. I understand partition labels and numbering having read various Grub tutorials but don't want to trash my existing boot system unnecessarily. My second drive is recognised by the BIOS.

A Normally a distro installs its bootloader to the Master Boot Record (MBR) of the first hard disk. When the computer boots, it sees the bootloader here and passes control to it. The problem with this is that each installation overwrites the previous one, as you have found out. Once you have a working boot menu that you like, you can prevent any other distro from overwriting it by taking the option to install that distro's bootloader to the root partition, which may be hidden in some advanced section of the installer. This means that the distro's bootloader is not written to the MBR and the original bootloader is untouched.

Instead, it goes to the start of the main system partition used by that particular distribution. Now you can edit the original distro's boot menu to add an option that passes control to your new distro. First you need to know where the root partition is, which you should have seen during installation. If you are installing to the first partition of an external drive, it is probably /dev/sdb1. Linux designates hard drives as sd (or sometimes hd) followed by a letter - 'a' for the first drive and so on, and a number for the partition, starting at one. Just to confuse you, Grub uses a different scheme and labels drives (hdx,y) where x is the number of the drive and y the number of the partition on that drive, both counting from zero.

So the first partition on the second drive is /dev/sdb1 in Linux terms and (hd1,0) to Grub. Now you understand that, boot from the distro that owns your main bootloader, SUSE in this case, and edit it to add an entry for the new distro. You can edit the bootloader in Yast or by editing the file /boot grub/menu.lst directly (you have to do this as root) in a terminal with

su
nano /boot/grub/menu.lst

Scroll down the text and you will see the existing menu entries, then add one for your new distro with

title My New Distro
root (hd1,0)
chainloader +1

The first line is the text for the menu, the second tells it the location of the partition containing the new distro's bootloader and the final line passes control to that bootloader. Select this and you will see the new distro's boot menu. If Grub reports error 21 or 22 you have incorrectly specified the partition in the root line. You can press E while your new menu entry is highlighted, select the root line and press e again to edit it. Change the root line, press Esc to apply the change and B to try booting it again. You cannot do any damage when experimenting like this. Once you find the correct value, edit the menu.lst file as above to make the change permanent.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar