Tips & tricks: make a bootable GRUB CD-ROM

For the uninitiated, GRUB is the Grand Unified Bootloader. It's a little tiny, but important, bit of software that allows you to actually boot into Linux, BSD and all sorts of other operating systems (it even 'chainloads' Windows in a dual-boot environment).

It's great when it's working fine, but occasionally you might lose it. If you're doing a dual boot, and you reinstall Windows, for example, Windows setup helpfully deletes any other bootloader on the system for you.

In these cases, it can be a really good idea to burn yourself a copy of GRUB on CD, so that if for some reason you can't boot in, you can pop in your CD, type in the boot commands for your system and get right up and running again (perhaps reinstalling GRUB to the hard drive again).

Making a GRUB CD is frightfully easy - in fact there is a page on the official GNU GRUB site all about it:

Here is an example of procedures to make a bootable CD-ROM image. First, make a top directory for the bootable image, say, iso:

$ mkdir iso

Make a directory for GRUB:

$ mkdir -p iso/boot/grub

Copy the file stage2_eltorito:

$ cp /usr/share/grub/i386-pc/stage2_eltorito iso/boot/grub

If desired, make the config file menu.lst under iso/boot/grub (see Configuration), and copy any files and directories for the disc to the directory iso/.

Finally, make a ISO9660 image file like this:

$ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
-boot-load-size 4 -boot-info-table -o grub.iso iso

This produces a file named grub.iso, which then can be burned into a CD (or a DVD). mkisofs has already set up the disc to boot from the boot/grub/stage2_eltorito file, so there is no need to setup GRUB on the disc. (Note that the -boot-load-size 4 bit is required for compatibility with the BIOS on many older machines.)

In most cases, just follow those instructions and you'll end up with a nice shiny ISO image that you can burn to CD with your favourite burning software and get yourself out of that next sticky situation (or fix your Linux dual boot part after installing Vista, maybe).


Avatar for peter Peter Upfold -

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Tips & tricks: make a bootable GRUB CD-ROM

Home » Articles » Tips & tricks: make a bootable GRUB CD-ROM