Boot an ISO via Grub2

1815

I’ve tested it with grml-small 2008.11 and grml-small 2009.05-rc1 using grub2 from Debian/unstable (1.96+20090317-1). In the following example the ISO file grml-small_2008.11.iso is available in directory grml on device /dev/sda1. You can boot it from the interactive grub shell using:

loopback loop (hd0,1)/grml/grml-small_2008.11.iso
linux (loop)/boot/grmlsmall/linux26 isofrom=/dev/sda1/grml/grml-small_2008.11.iso boot=live quiet vga=791 noeject noprompt
initrd (loop)/boot/grmlsmall/initrd.gz
boot

So if you are using grub2 already consider adding an entry like the following to your grub config (/boot/grub/grub.cfg):

menuentry "grml-rescue system from harddisk (ISO = grml-small_2008.11.iso)" {
loopback loop (hd0,1)/grml/grml-small_2008.11.iso
linux (loop)/boot/grmlsmall/linux26 isofrom=/dev/sda1/grml/grml-small_2008.11.iso boot=live quiet vga=791 noeject noprompt
initrd (loop)/boot/grmlsmall/initrd.gz
}

This entry gives you the option to boot grml from your harddisk even if you don’t have the possibility to boot via CD/USB/PXE/….

Tip: starting with grml 2009.05(-rc1) you can also use findiso=/path/to/grml.iso instead of isofrom=/dev/sdX/path/to/grml.iso. findiso is a dynamic version of isofrom as it looks for the specified ISO file on all disks where it usually looks for the .squashfs file (so you don’t have to know the device name compared to isofrom=…). The above configuration using findiso is even easier to set up and would look like this:

menuentry "grml-rescue system from harddisk (ISO = grml-small_2008.11.iso)" {
loopback loop (hd0,1)/grml/grml-small_2008.11.iso
linux (loop)/boot/grmlsmall/linux26 findiso=/grml/grml-small_2008.11.iso boot=live quiet vga=791 noeject noprompt
initrd (loop)/boot/grmlsmall/initrd.gz
}
 Original post