How to boot an iso file from Hard Drive using GRUB2

Hey guys, how are you ? 😀

This time, I would share my experience while trying to boot an iso file which is stored in the hard drive. Ah, this article should be useful for  :

  1. someone who doesn’t have a CD-ROM or USB Flash Drive, but really want to try Linux.
  2. someone who broke her/ his PC (the OS), and need to recover it via LiveUSB/LiveCD (back to point 1, doesn’t have CD-ROM) lol
  3. someone with high curiosity 😀

I got the point 1 here. I have a laptop, but its DVD-ROM was broken. I have a USB Flash Drive, but it borrowed by my senior since few days ago, and not returned yet … 😀 (poor me.., huh?)

I searched on Google, and found some tutorials about this. Try – error, try – error, try – error ! Hahahaaa, I was confused a little. I Google-ed it again, and found a thread in archived ubuntuforums.org which is marked as [SOLVED] by the TS. I thought, this thread is what I’m looking for.

I tried it, and la viola !! It works like a charm on my box 😀

Nah, here are the steps to follow :

Step #1, make sure you have set the permission of grub.cfg to 666 (necessary, cz we need to edit it)

sudo chmod 666 /boot/grub/grub.cfg

Step #2, open it with gedit

sudo gedit /boot/grub/grub.cfg

and then, add the following lines so it looks like this :

### BEGIN /etc/burg.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change# the 'exec tail' line above.

menuentry "Ubuntu 10.10 ISO Image"  {
set isofile="/path/to/the/iso/ubuntu-10.10-desktop-i386.iso"
loopback loop (hd0,7)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile boot=casper nomodeset
initrd (loop)/casper/initrd.lz
}

### END /etc/burg.d/40_custom ###

We have to set the parameter according to your partition schema. To find out your partition, open another terminal and run this command :

sudo fdisk -l

this will shows you list of partitions available on your box.

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1305    10482381    7  HPFS/NTFS
/dev/sda2            1306       19457   145805909+   5  Extended
/dev/sda5            1306        3916    20972826   83  Linux
/dev/sda6   *        3917        5090     9430123+  83  Linux
/dev/sda7            5222       19457   114350638+  83  Linux
/dev/sda8            5091        5221     1052226   82  Linux swap / Solaris

yeah, first we have to set the loopback partition. Note that the bold one, that is my /home partition where I put the iso file. We must set the loopback partition to this, so it should be looks :
loopback loop (hd0,7)$isofile

‘0’ means number of the harddisk, and ‘7’ means number of partition where you put the iso file.

Next, we must set the isofile variable :
set isofile="/budi/Software/iso/ubuntu-10.10-desktop-i386.iso"

where the exactly path is :
/home/budi/Software/iso/ubuntu-10.10-desktop-i386.iso

You can change the name of this variable as you want, maybe ‘theiso’ or something like that. If you change the variable name, please remember to change this one too :
loopback loop (hd0,7)$isofile

Got it ? 😀

Save and close. Restart your box, and then choose “Ubuntu 10.10 ISO Image” from the menu list. It will bring you to the Ubuntu LiveHDD. lol

I tried to install Ubuntu from this LiveHDD, but it failed. From the warning, installer attempted to unmount some partitions and it couldn’t be done. If you can install it from LiveHDD, please tell me. Maybe I have something wrong in my installation. hehehe 😀

Source :
http://ubuntuforums.org/archive/index.php/t-1535864.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s