The mkbootdisk Command

The mkbootdisk command is used to create an emergency boot floppy. Such a disk can often be used to start a Linux system that will not start in the ordinary way, typically because of damage to the LILO or GRUB startup file.

The general syntax for mkbootdisk is

mkbootdisk [options] kernel

No options are required, and all that is necessary is to supply the name of a kernel (i.e., the core of the operating system) currently on the system.

Assuming that the floppy disk is inserted in the first floppy disk drive and that the kernel is version 2.4.20-6, the following command would be used:

/sbin/mkbootdisk 2.4.20-6

The mkbootdisk executable (i.e., runnable program) is by default located in the /sbin directory. If this directory is not in the 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 floppy device file is by default /dev/fd0 (i.e., the first floppy drive). However, another floppy device can be specified with the --device option for those rare situations in which a machine has more than a single floppy drive. mkbootdisk instructs the user to insert a floppy disk, even if one is already in the floppy drive, and waits for confirmation before continuing unless the --noprompt option is specified.

The floppy disk cannot be mounted (i.e., logically attached to the filesystem) when mkbootdisk is used. If it has been mounted for some reason (some systems are set up to mount floppies automatically), it can easily be unmounted with the umount command, i.e.,

umount /dev/fd0

The --size option is followed by the size (in kilobytes) of the image (i.e., exact copy) to use for the boot disk. If this option is not used, mkbootdisk will assume a standard 1.44MB floppy disk.

The --iso option instructs mkbootdisk to make a bootable ISO image on the hard disk that can later be used with a CD writer to create a bootable CDROM. Bootable means that it is capable of loading the operating system into memory so that the computer becomes usable and application programs can be run.

By default mkbootdisk writes no output on the display screen. This can be changed with the --verbose option, which instructs it to provide information about what it is doing, although the amount of information is small because of the simple functioning of mkbootdisk.

The --version option displays the version of mkbootdisk and exits. In contrast to many command line programs (i.e., all-text mode programs), there is no --help option for mkbootdisk.

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, and it is bootable.

A new boot floppy should always be tested immediately after making it by using it to reboot (i.e., restart) the computer.

Created June 23, 2005.
Copyright © 2005 The Linux Information Project. All Rights Reserved.