Monday, March 30, 2009

Boot an ISO image from hard disk?

1st Method:

1. Create a mountpoint to mount the ISO with loopback:
mkdir /mnt/LiveISO

2. mount the image:
mount -t iso9660 -o loop,ro /DOWNLOADS/debian-5.0-i386-en.iso /mnt/LiveISO

3. Create a directory on the device where you are going to boot from:
mkdir /mnt/hda4/Debian-Lenny

4. Copy the contents of the mounted image to that directory:
cp /mnt/LiveISO/Debian-Lenny/* /mnt/hda4/Debian-Lenny/

5. copy kernel and initrd files to your boot device:
cp /mnt/LiveISO/boot/* /boot

* Grub:
title Debian-Lenny
root (hd0,0)
kernel /linux26 ramdisk_size=100000 fromhd=/dev/hda4
initrd /minirt26.gz

* Lilo:
append="ramdisk_size=100000 fromhd=/dev/hda4"

The basic idea is that you copy the contents of the ISO to a partition. Then, in your current linux OS, you copy the kernel and initrd images from the ISO to your current boot directory. Last, you edit LILO so that it points to the kernel and initrd images you just copied, and make sure you append the "fromhd" line so that the "livecd" will know where the rest of the Debian-Lenny files are.

2nd Method:

It is possible to boot and install from an debian.iso/ubuntu.iso file on hard-disk. You will need a spare partition on your hard drive and an existing grub menu (on livecd, floppy or hd). This is sometimes known as fromiso or frugal install.

The basic steps are as follows.

* Create and format (if you don't already have one) a partition to boot fromiso.
* Download debian.iso file to a folder and extract to the same folder the vmlinuz and initrd.gz files.
* Add the correct entry to the existing grub menu.

Example: LinuxA grub on sdb1 (hdb1), LinuxB on sdb6 (hdb6)

* Make a directory/folder in sdb6 called Debian-Lenny.
* Download debain.iso ( from ) and the available vmlinuz and initrd.gz files to /mnt/sdb6/Debian-Lenny
* Customize the boot/grub/menu.lst of LinuxA on sdb1 (hdb1). Add this entry to the end.

title Debian-Lenny GNU/Linux

kernel (hd1,5)/Debian-Lenny/vmlinuz vga=791 fromhd=/dev/sdb6 fromiso=/Debian-Lenny/debian.iso en xres=1024x768

initrd (hd1,5)/Debian-Lenny/initrd.gz


You can get the vmlinuz (kernel binary) and initrd.gz (ramdisk image) files from here:

Note: Typically, FTP is faster, and therefore the preferred method. There is no difference in the quality or content of the HTTP download compared to the FTP option.

To extract the vmlinuz and initrd.gz files from the debian.iso

1. mkdir -p /mnt/sdb6/Debian-Lenny/test
2. mount -t iso9660 -o loop,ro /mnt/sdb6/Debian-Lenny/debian.iso /mnt/sdb6/Debian-Lenny/test

Now copy the vmlinuz and initrd.gz files from the mounted iso image to the directory

1. cp /mnt/sdb6/Debian-Lenny/test/boot/vmlinuz /mnt/sdb6/Debian-Lenny/
2. cp /mnt/sdb6/Debian/test/boot/initrd.gz /mnt/sdb6/Debian-Lenny/

Note: Please do not change download ISO file. In some cases it doesn't work.


dannybuntu said...

I will try this now :) thank you so much.

Canute said...

In the section "Booting and Installation from ISO on hard-disk" you have mentioned that we can download the kernel and initrd images from "" how are these "hd-media" images different from the ones included in the iso?

Also at the bottom in the same section you have asked to extract the vmlinuz and initrd.gz images as well, which ones are supposed to be used in grub?

Rakesh said...

It's second method to install Lenny from hard disk. In this method, the vmlinuz and initrd.gz files are required to install on you computer.

>>Also at the bottom in the same section you have asked to extract the vmlinuz and initrd.gz images as well, which ones are supposed to be used in grub?

At the bottom, it's mentioned that after extracting the vmlinuz and initrd.gz files where these should be copied onto your hard drive.

Canute said...

Where are we supposed to use the "hd-media" images?

Rakesh said...

Hello Canute,

The hd-media images (vmlinuz and initrd.gz) for the graphical installer.

If a CD iso is downloaded/placed/copied in a partition on your hard drive and you want to install packages from that, you need the hd-media images. But I let you know the hd-media - probably not feasible with 6GB drive, unless you can first create a separate small partition for the iso, or have an external drive (you can use the hd-media images from USB stick (as an external drive) to install Lenny or other Linux distro.

Technical note: it is important to use the hd-media images because otherwise the installer won’t be able to find the ISO image later.


Rakesh said...

The hd-media images (vmlinuz and initrd.gz) is used for the graphical installer.

Canute said...

If we use the "fromhd=/dev/sdb6 fromiso=/Debian-Lenny/debian.iso" boot parameter do we still need the hd-media images to install from the debian.iso in sdb6?

Canute said...

If "fromhd=/dev/sdb6 fromiso=/Debian-Lenny/debian.iso" is required even with the hd-media images where are the images extraced from the iso useful?

Rakesh said...

No need of this.

Anonymous said...

I try with initrd/hdmedia, but after
first step, an error showing that
kernel present not equal at kernel to that present in the cd. Do not continue.