grub2 - booting an ISO image from an HDD

Need to boot an ISO image from an HDD via GRUB2? See how to create a manual entry for a LiveCD (e.g. Slax) or other programs. Skip os-prober!

Below I'll show how to boot an ISO image located on a disk from within GRUB. This can be either a LiveCD or other programs, e.g. Acronis True Image. In this case, the os-prober application isn't able to help us - we have to create the appropriate entry ourselves in /etc/grub.d/. It should be noted that the configuration given below is a specific example for the Slax LiveCD system.

  • we create the file etc/grub.d/44_liveCD_slack
  • #!/bin/sh -e
    echo "Adding Slax LiveCD" >&2
    cat << EOF
    menuentry "slax LiveCD"  {
    loopback  loop /root/iso/slax-6.1.2.iso
    linux       (loop)/boot/vmlinuz from=/root/iso/slax-6.1.2.iso ramdisk_size=6666 root=/dev/ram0 rw autoexec=startx
    initrd      (loop)/boot/initrd.gz
    }
    EOF
    
  • of course update-grub2