Wednesday, December 21, 2011

Using Grub4DOS to Create a Bootable USB Drive From ISO

Grub4dos is mainly a boot manager which can be installed in a pen drive or portable hard disk to use as a parallel grub if ur on board grub is down.this can be also used to install certain linux os directly from the iso in the hard disk.This mainly work for ubuntu linux mint and puppy iso's.tthe grub can be also used to log in to the xp and windows 7 if the bootloader is lost.

first we need to install the grub4dos into the pendrive.get the grub4dos from following link

http://dl.dropbox.com/u/30579529/grubinst-1.1-bin-w32-2008-01-01.zip

and unzip to get grubinst_gui.exe and run it..

Once the program is started, select the Disk option, then click the Disk Refresh button and then select your flashdrive from the dropdown box

You should be able to tell which disk is your flashdrive by the size shown for each drive.

Now click the Part List Refresh button, then the dropdown box and finally select the Whole disk (MBR) option.

Check the Don't search floppy option, leave all the other options unchecked and cleared and then click the Install button to install Grub4DOS to the MBR of the flashdrive.

and grub is installed .....

now copy the grldr and menu.lst files from the downloaded and put it in the hard disk

edit the menu.lst to boot iso...'

my menu is as below i put my iso's in a folder named ISO in the drive and each iso has its own corresponding folders

color blue/green yellow/red white/magenta white/magenta
timeout 30
default /default

title Fedora 15 LiveCD - extracted
root (hd0,0)
kernel /ISO/fedora/vmlinuz0 rootfs=auto root=UUID= liveimg live_dir=/LiveCD/LiveOS/ ro quiet rhgb
initrd /ISO/fedora/initrd0.img

title Fedora 14 Live CD
root (hd0,0)
kernel (hd0,0)/vmlinuz0 linux askmethod
initrd (hd0,0)/initrd.img
boot

title FIND AND BOOT NT/2K/XP
fallback 1
find --set-root --ignore-floppies /ntldr
chainloader /ntldr
savedefault --wait=2

title FIND AND BOOT BOOTMGR of Windows VISTA/7
fallback 2
find --set-root --ignore-floppies /bootmgr
chainloader /bootmgr
savedefault --wait=2

title find and boot RedHat/Centos/Fedora Linux with menu.lst already installed
fallback 5
find --set-root /grub/menu.lst
savedefault --wait=2
configfile /grub/menu.lst

title Puppy Linux
find --set-root --ignore-floppies /ISO/puppy/initrd.gz
kernel /ISO/puppy/vmlinuz pmedia=usbflash psubdir=ISO/puppy
initrd /ISO/puppy/initrd.gz

title Linux Mint 12
find --set-root --ignore-floppies /ISO/mint/initrd.lz
kernel /ISO/mint/vmlinuz iso-scan/filename=/ISO/mint/linuxmint-12.iso file=/cdrom/preseed/mint.seed boot=casper noprompt
initrd /ISO/mint/initrd.lz

title Ubuntu 11
find --set-root --ignore-floppies /ISO/ubuntu/initrd.lz
kernel /ISO/ubuntu/vmlinuz iso-scan/filename=/ISO/ubuntu/ubuntu-11.iso file=/cdrom/preseed/ubuntu.seed boot=casper noprompt
initrd /ISO/ubuntu/initrd.lz

title commandline
commandline

title reboot
reboot

title Shutdown
halt

for windows 7 just unzip the iso into the root directory of the drive and use the code above

for ubuntu and linux mint we must unzip the files for vmlinux and initrd and put in same folder as in ISO

For fedora first we need to extract the LiveOS folder to the root of our pendrive and also extract vmlinuz and initrd.img to the LiveOS folder form isolinux folder and the following to the menu.lst

title Fedora default
find --set-root /LiveOS/vmlinuz0
kernel /LiveOS/vmlinuz0  root=live:CDLABEL=BOOT  rootfstype=auto ro liveimg quiet rhgb rd.luks=0 rd.md=0 rd.dm=0
initrd /LiveOS/initrd0.img

here in the code CDLABEL =BOOT  ,BOOT must be your usb name given to usb

for Redhat first we need to copy the image folder into the root folder and give the code as below as per your path to vmlinuz and initrd.img

title RedHat6.2 default
find --set-root /ISO/redhat6.2/isolinux/vmlinuz
kernel /ISO/redhat6.2/isolinux/vmlinuz  root=live:CDLABEL=BOOT  rootfstype=auto ro liveimg quiet rhgb rd.luks=0 rd.md=0 rd.dm=0
initrd /ISO/redhat6.2/isolinux/initrd.img

and duirng installation select the iso form hard disk or pendrive where you have extracted the image folder

example for menu.lst https://dl.dropbox.com/u/30579529/menu.lst

3 comments:

  1. Dear Rahul,

    "for ubuntu and linux mint we must unzip the files for vmlinux and initrd and put in same folder as in ISO"


    You don't need to unzip these files for Linux Mint and Ubuntu... Just copy the ISO files to your ISO folder and use the menu.lst entry given below to boot Linux Mint.. Just change the file name to the iso file you are using. This is also applicable for the Ubuntu and other Ubuntu variants like Kubuntu, Lubuntu etc. I am presently running almost all of them like this though the persistent feature does not work which means that it is always fresh.

    title Linux Mint 9
    find --set-root /linuxmint-9-gnome-cd-i386.iso
    map /linuxmint-9-gnome-cd-i386.iso (0xff)
    map --hook
    root (0xff)
    kernel /casper/vmlinuz file=/cdrom/preseed/mint.seed boot=casper persistent iso-scan/filename=/linuxmint-9-gnome-cd-i386.iso floppy.allowed_drive_mask=0 splash
    initrd /casper/initrd.lz

    Hopes this works, thanks

    ---spwizard---

    ReplyDelete
  2. hello Spwizard

    i tryed ur code but i am getting an error as

    file not found
    at line
    find –set-root /linuxmint-9-gnome-cd-i386.iso

    ReplyDelete
  3. See http://www.rmprepusb.com/tutorials/linuxmint14 for direct ISO booting with persistence from a USB drive

    ReplyDelete