How to Make a Linux Emergency Boot Floppy

An emergency boot floppy disk can be invaluable in the event that a computer fails to boot (start up) from the hard disk drive (HDD). The most common reason that a Linux computer fails to boot from its HDD is damage to the LILO or GRUB startup file, which is often the result of errors in reconfiguring them by a user.

Fortunately, it is very easy to make an emergency boot floppy for a Linux system. In fact, most major Linux distributions (i.e., versions) allow (and even encourage) creation of such a disk during installation of the operating system. It is always a good idea to take an extra minute and do this.

Likewise, it is also a simple matter to create an emergency boot floppy after the operating system has been installed. This can be particularly useful if the boot disk made at the time of system installation has been damaged or lost or if changes have been made to the kernel (i.e., the core of the operating system) or to the boot partition (i.e., the section of the HDD that holds the files necessary for booting).

The first step is to insert a standard 1.44MB floppy disk into the floppy disk drive. The chances for problems are minimized by using a new disk rather than a used one because a new one is much less likely to have bad blocks (i.e., defective areas on its magnetic coating). The floppy should also be formatted. Most new floppy disks come preformatted from the factory, but if the disk is not already formatted or is a used disk that needs to be reformatted, this can be accomplished in Linux using the fdformat command, i.e.,

fdformat /dev/fd0

/dev/fd0 represents the first, and usually the only, floppy drive on a computer. The disk must be unmounted, i.e., inserted into the drive but not logically attached to the main filesystem. A floppy in /dev/fd0 that has been mounted for some reason (usually because some systems are set up to mount floppies automatically) can be unmounted by using the umount command, i.e.,

umount /dev/fd0

The floppy can also be formatted using GUI (graphical user interface) tools such as Floppy Formatter on Linux or by using the format command on MS-DOS.

The emergency boot floppy can then be created using the mkbootdisk command. No options are required, and all that is necessary is to supply the name of the kernel currently on the system (or the desired kernel for booting if there are multiple kernels on the system).

Assuming that the kernel is version 2.6.4, the following should be typed in a console (i.e., all-text display mode) or terminal window (i.e., console emulation window in a GUI) and then the ENTER key pressed:

/sbin/mkbootdisk 2.6.4

The mkbootdisk executable (i.e., runnable program) is by default located in the /sbin directory (which contains mainly system administrative tools). If this directory is not in the user's PATH variable (i.e., the list of directories in which the system searches for a command executable), then it is necessary to either add /sbin to the beginning of the command (as shown above) or to first change to the /sbin directory with the cd command, i.e.,

cd /sbin

The boot floppy created by mkbootdisk contains five files: boot.msg, initrd.img, ldlinux.sys, syslinux.cfg and vmlinuz. vmlinuz is the compressed Linux kernel executable.

A new boot floppy should always be tested immediately after making it. This is, of course, accomplished by using it to reboot (i.e., restart) the computer. For some computers it might be necessary to change the boot sequence (i.e., the order in which the computer looks for a start-up disk) in the BIOS (basic input output system) so that the computer is configured with the floppy drive as the first boot device (or at least before the HDD). The BIOS configuration screen is accessed by pressing some specified key when the computer is starting. The specific key depends on the computer, but it is often the DELETE key or the F2 key.

When a computer is booted from a boot floppy, a copy of the kernel is loaded into the computer's memory and remains there for the duration of the computer session. Thus, the floppy can be removed from the floppy drive as soon as booting has been completed, and that drive can then be used for other floppies if desired.

It should be kept in mind that an emergency boot floppy may not work in some situations, particularly if the cause of the problem is something other than a defective startup file. However, it is often useful and is definitely worth having considering the very small amount of time and effort required to make it.

Created July 31, 2005.
Copyright © 2005 The Linux Information Project. All Rights Reserved.