Nov 09 2009 08:01 pm

Posted by under Do It Your Self,ICT,Keminter

Boot from ISO file on UFD/ HD

It’s quiet long time ago, for having and idea of directly booting an ISO file (CD/ DVD image) of a instaler CD or LiveCD, like Ubuntu CD, instead burn it to the disc or extract the content into UFD (USB flash disk) or hardisk. Now, we can do it using GNU GRUB (“GRUB” for short) as a boot loader package from the GNU Project (http://en.wikipedia.org/wiki/GNU_GRUB).

Main Files: Kernel, RAM disk, ISO file

We will use the files from Linux installer, it’s kernel and it’s initial root filesystem (RAM disk or intrd image). This initrd image contains a lot of executables and drivers for mounting the real root filesystem. When real real root filesystem is mountet, the initrd is unounted, then the memory is freed. Both files are named differently in different distros. Find it it Table 1 for the names.

Table 1: Names of kernel and RAM disk images in some popular distros
Distro Kernel path in CD RAM disk path in CD
Fedora /isolinux/vmlinuz /isolinux/initrd.img
RHEL5/CentOS5 /isolinux/vmlinuz /isolinux/initrd.img
openSUSE /boot/i386/loader/linux /boot/i386/loader/initrd
Mandriva /i586/isolinux/alt0/vmlinuz /i586/isolinux/alt0/all.rdz
Ubuntu /casper/vmlinuz /casper/initrd.gz
Debian /install.386/vmlinuz /isolinux/initrd.img
 

Now, here we are, preparing our UFD for booting from ISO file, and make it from Windows. In this case we will use kernel and initrd image from Ubuntu 9.04, and try to boot Ubuntu.
So, we can use:

Steps

Now, we can start the steps:

  1. Prepare the UFD
    If necessary, we can format it first. It’s recommended we use FAT32 format.
    wingrub-format
    For advance user, there is a nice tools to do that. Find it in:
    http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&cc=us&mode=3&taskId=135&swItem=MTX-UNITY-I23839
  2. Make UFD bootable (with Grub)
    It will be easier if we use WinSetupFromUSB, but you can try another applications.
    winsetupfromusb
    Don’t touch enything, unless “USB Disk Selection”, “Copy setup boot files only”, and “Test in QEMU”.
    After finished, the UFD will be “Grub-bootable”, and has these files:

    J:\default
    J:\grldr

    Save it into your UFD (e.g. J:\), enter file name with menu.lst, and don’t forget to change “Save as type” into “All Files”Type these lines into menu.lst file:
    color white/black yellow/black
    timeout 5
    default /default title Ubuntu
    find --set-root --ignore-floppies /ubuntu/vmlinuz
    kernel /ubuntu/vmlinuz iso-scan/filename=/ubuntu/ubuntu-9.04-desktop-i386.iso quiet splash boot=casper persistent --
    initrd /ubuntu/initrd.gz
    boot

    That code means that Grub will make a boot menu, with 5 seconds of timeout before boot into first menu (with “Ubuntu” title). In the “Ubuntu” title, Grub will try to find /ubuntu/vmlinuz as root, run vmlinuz to open ubuntu-9.04-desktop-i386.iso ISO file, then open initrd.gz as RAM disk image.Please note that the line in kernel is long line, the next line is initrd.
    That code also enabling the persistent Ubuntu (recognize the word “persistent” in the kernel line code). But, it requires J:\casper-rw file (it can be made later).

    From now on, UFD has these files:
    J:\default
    J:\grldr
    J:\menu.lst
    J:\ubuntu\initrd.gz
    J:\ubuntu\ubuntu-9.04-desktop-i386.iso

    J:\ubuntu\initrd.gz

  3. Copy ISO file to UFD
    Copy the downloaded ISO file (ubuntu-9.04-desktop-i386.iso) into UFD. We can make a folder (e.g. “boot” and copy the ISO in it)
  4. Copy 2 files (vmlinuz kernel and initrd.gz initrd image) from ISO into UFD
    Open ISO file (ubuntu-9.04-desktop-i386.iso) with WinRAR, copy vmlinuz and initrd.gz from “Casper” folder of the ISO.
    Copy it in UFD, e.g. in “ubuntu” folder.
  5. Make/ edit menu.lst of the Grub
    If not exist make menu.lst file in J:\.
    We can use Notepad, and save it into the respective name.
    notepad
  6. Boot for first time
    grub
    ubuntu-boot
    ubuntu-desktop
  7. Create casper-rw file
    If casper-rw file is provided, then we can make ISO-boot Ubuntu persistent.
    Don’t close the 1st booting, we need it to make the casper-rw file.
    Open terminal, enter /isodevice
    $ cd /isodevice

    Create a 512 MB file, named casper-rw.
    $ sudo dd if=/dev/zero of=casper-rw bs=1M count=512

    Format the casper-rw file
    $ sudo mkfs.ext3 -F casper-rw
  8. In case, you are not satisfied with the size of casper-rw, and want to resize:
    $ sudo dd if=/dev/zero bs=1M count=1024 >> casper-rw
    $ sudo resize2fs casper-rw
  9. Ready

Ubuntu 9.10

As it’s already mentioned above, the main files are kernel and RAM disk image. Just extract those files from Ubuntu 9.10 ISO file. The files in CD are located on:
/casper/vmlinuz
/casper/initrd.lz

Note that the RAM disk image file has extension .lz

If you want to save Ubuntu 9.04 and Ubuntu 9.10 (and kernel & RAM disk files) in the same folder, just feel free rename them, and adjust the respective names in the menu.lst.

3 Comments »

3 Responses to “Boot from ISO file on UFD/ HD”

  1. net says:

    walaaaaaaaaah keren banget om

  2. odydasa says:

    @Ndro: ya dicoba aja…
    Yg versi komplet, aku gabung dg berbagai diskimage, mini linux hardiskimage, dll…
    Utk installer winxp & viesta, BartPE, dll, bisa pakek winsetupfromusb ituh.

Leave a Reply

Spam Protection by WP-SpamFree