Saturday, November 13, 2010

Boot Multiple Operating Systems (OSs) using a USB Drive.

There are some cases where you may need to maintain many number of CDs, DVDs and USB drives written with different Operating Systems for the purpose of installation or booting Live OS. Its really tiresome to create different OS images on different devices. Hence, here is a solution that helps you to maintain a Single device with Large number of OS images installed in it. The method is very easy and you may delete or add any number of OS images (depending on the size of your device) without much efforts.

In this method, we make use of USB (pen) drives. I prefer Ubuntu Linux to do this and the steps are as explained below.

Steps:

1. Get a USB drive with 4GB / 8 GB or higher memory capacity. Format the drive to vfat or ext4 filesystem.


Note : 
        a). In ubuntu you may use gparted command to do this. Or you my use fdisk too.
        b). You need to unmount the drive before partitioning.

2. Now, install grub (which is known as a bootloader) on the drive with following command.

sudo grub-install --no-floppy --root-directory=/mnt /dev/sdc 

Note : 
        a). Where /mnt is the mount location for the drive. /dev/sdc is device ID.
        b). Please ensure that you have grub2 installed in your  Ubuntu, in order to get better results.


After "grub-install", you will be able to see a folder boot which contains subfolder grub with lots of files in it.

3.  Add menus to your "grub" by editing the file grub.cfg.

For example :


menuentry "Ubuntu 10.04 Desktop i386" {
  loopback loop /iso/ubuntu-10.04-desktop-i386.iso
  linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-10.04-
desktop-i386.iso noeject noprompt --
  initrd (loop)/casper/initrd.lz
}
 
Add menus If your grub.cfg contents are as given above, then this will show 
a Menu "Ubuntu 10.04 Desktop i386" while you boot from the USB Drive.
You may add sufficient number of menus depending on the number of .iso files.
4. Now create a folder named "iso" in the same location where your boot folder is.
5. Copy iso image, Ubuntu-10.04-desktop-i386.iso into the "iso" folder.
You may copy more ".iso" images of different OSs and add the menu entry into the 
"grub.cfg" file.
6. Restart your computer and select the USB drive as the boot device. This will 
display a menu list of OSs to select and boot.
Thats all folks!!!!!
grub
 

No comments:

Post a Comment