Wednesday, February 03, 2016

Booting From an ISO image using GRUB

Sometimes, it's handy to use a specialized boot environment on your system. Examples include SpinRite, GParted, TRK, FalconFour's Ultimate Boot CD and others.

Typically, you have a CD or DVD of that environment, insert it and boot from that.

Assuming that your own system isn't borked, it is possible to use GRUB to load the ISO image and boot from that. Here's how . . .

The special software that allows you to boot from an ISO image on your drive is SYSLINUX. While it is a complete boot system, mostly noted for its ability to boot from MS-DOS and MS Windows FAT filesystems, it contains a program named MEMDISK.

NOTE: While I am focusing on Linux systems, SYSLINUX and MEMDISK have MS Windows  versions, so with a careful reading of the documents you can do the same thing on a MS Windows computer.

Intended primarily to allow you to boot legacy operating systems, it also allows you to boot from floppy disk images, hard drive images and ISO images.

To use it, copy MEMDISK from where your system installs it by default into the /boot directory. Then, copy the ISO image you want to boot from into /boot as well.

The web page for MEMDISK describes how to configure your main bootloader to launch MEMDISK and have it boot your ISO image.

For my Mageia5 Linux system, the lines that are added manually to /boot/grub/menu.lst are as follows for SpinRite.iso as an example.

title SpinRite_6.1
root (hd0,0)
kernel (hd0,0)/boot/memdisk BOOT_IMAGE=SpinRite iso
initrd /boot/SpinRite.iso

If the filename of your ISO image is long, don't be afraid to rename it to something more convenient to type.

Sometimes it is necessary to use append iso raw. Try that if booting fails at first.

Using PLPBT, an Alternative Boot Loader

Rather than booting an image of an operating system or a live image of a utility, it make be necessary to boot from a different device. Most modern motherboard BIOS have a feature that allows you to boot from a number of different devices attached to your system.

If you BIOS does not support that, the Plop Boot Manager can help. It provides executables for DOS, MS Windows and Linux as well as for booting over a network.

For Linux, you copy the file plpbt.bin to your /boot directory and your GRUB entry in /boot/grub/menu.lst looks like:

title Plop Boot Manager
root (hd0,0)
kernel /boot/plpbt.bin

The documents also show how to create other boot images using the Plop Boot Manager.

No comments: