Thursday, December 29, 2011

Grub2: Booting from live ISO or Gparted

Grub2 has gained traction and is now available in most major Linux distributions. At times, in Linux , you require to do some stuff, like for example boot an ISO located in your hard drive - I use Russian Fedora and wanted to see if there was much difference with Linux Mint, and decided to boot from the ISO as my DVD-ROM doesn't work. Of course my laptop is a Compaq.

Other reasons for wanting to boot into an ISO , is when you want to partition your drives, using a tool such as Gparted. Gparted sets up a Grub grub.config for you, however , if you upgraded from Grub to Grub2, Gparted may use Grub config and miss Grub2 which uses the different grub2.cfg.


Luckily, you can edit Grub during boot to boot into whatever your choice is. To boot a Linux Live CD, use these settings (settings can be added to grub2.cfg file or added to grub2 as comp boots, by pressing 'e' , however this is temporary and needs to be done for every reboot:

menuentry "Linux Mint live" {
      set isofile="/path-from-root-to-your-Linux-mint-ISO -file/linuxmint-12-gnome-cd-nocodecs-32bit.iso"
      loopback loop $isofile
      linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet noeject noprompt splash --
      initrd (loop)/casper/initrd.lz
    }

To boot Gparted into RAM(allows you to manage all partitions as none is mounted)  using Grub2 , use:

menuentry "Gparted live" {
      set isofile="/home/projects/Downloads/or-whatever-path-gets-to-your-Gparted-iso/gparted-live-0.11.0-7.iso"
      loopback loop $isofile
      linux (loop)/live/vmlinuz boot=live config union=aufs noswap noprompt ip=frommedia toram=filesystem.squashfs iso-scan/filename=$isofile
      initrd (loop)/live/initrd.img
    }

The above can be modified to boot from a USB. In case you are lost, you can use the ls  command to list what's available to you and the Tab key as a shortcut to complete your directives.

No comments:

Post a Comment