Thursday, November 8, 2012

How To Boot An ISO File From Your Hard Drive Via Grub2 Under Ubuntu/Linux Mint



In this tutorial, we will see how to boot an iso file stored in your hard drive via the Grub2 boot menu. This tip is useful for users who don't have a live CD/DVD/USB, only the iso file of Ubuntu/Linux Mint. In this example, we will see how to boot from Ubuntu 12.10 iso file.

Getting Started

Create a directory named iso in your root folder using this command:


sudo mkdir /iso

Now move your iso file (ubuntu-12.10-desktop-i386.iso) to this folder. Cd to the folder containing your iso file and run this command:

sudo mv ubuntu-12.10-desktop-i386.iso /iso

Identify now your hard disk with this command from the terminal:

 sudo fdisk -l

For my system, the hard disk is mounted as /dev/sda1:


Edit now the grub.cfg file with this command:

sudo gedit /boot/grub/grub.cfg

At the end of the file, add these lines:

menuentry "Ubuntu 12.10 LiveCD" { 
    set root=(hd0,1) 
    loopback loop /iso/ubuntu-12.10-desktop-i386.iso 
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-12.10-desktop-i386.iso noprompt noeject 
    initrd (loop)/casper/initrd.lz 
}



You can change "Ubuntu 12.10 LiveCD" to any name of your choice. For the "set root=(hd0,1)" option, I inserted the number "1" referring to my hard disk (dev/sda1). If your hard disk is mounted as /dev/sda2, then set "2", for /dev/sda5, set "5" and so on.

Save your file and exit. Then reboot your system and hold down the Shift key to bring up the Grub boot menu. As you can see, I can now boot into the Ubuntu 12.10 iso file stored in my hard drive from the Grub menu:


That's it!

No comments:

Post a Comment