How do I create a boot disk in Linux?

Written By: 'Stone Cold' Rich Steward

Like everything in Linux, there's more then one way to do it. I'll describe the two more popular ways. First locate the kernel image you are currently using. If you use LILO, have a look at the /etc/lilo.conf file. Here's an example lilo.conf file:

 boot=/dev/hda1
 map=/boot/map
 install=/boot/boot.b
 prompt
 timeout=0
 image=/boot/vmlinuz
        label=linux
        root=/dev/hda7
        read-only
The "image=" option indicates which kernel image you're using. Sometimes "image=" points to a symlink (a shortcut file for you Windows users). You'll need to know the actual file that the symlink points to:
Eg. [you@localhost you]$ ls -al /boot/vmlinuz lrwxrwxrwx 1 root root 20 Feb 19 18:32 /boot/vmlinuz -> vmlinuz-2.2.14-15mdk 
Here "vmlinuz" points to "vmlinuz-2.2.14-15mdk".

Method #1, the "dd" command

Now we'll use the "dd" command to copy the kernel image to a floppy disk. Insert the floppy disk prior to entering the "dd" command, but don't mount it. "dd" needs to write raw data to the disk, which is not possible if you mount the drive. Now type the following as root:

dd if=/boot/vmlinuz of=/dev/fd0 bs=8192

This is ok because "dd" follows the symlink to the right file ("vmlinuz-2.2.14-15mdk"). You could have also used the complete file name. Eg. dd if=/boot/vmlinuz-2.2.14-15mdk of=/dev/fd0 bs=8192

Method #2, the "mkbootdisk" command

"mkbootdisk" needs to know the version of your kernel. In this example, the version is "2.2.14-15mdk", which is just the last part of "vmlinuz-2.2.14-15mdk". If your kernel doesn't have any version information in the filename, pick the latest kernel version from the "/lib/modules" directory.

Eg. [you@localhost you]$ ls /lib/modules
2.2.13-22mdk 2.2.14-15mdk

Now type the following as root:
mkbootdisk --verbose --device /dev/fd0 2.2.14-15mdk

With the method, we have the option of using a "rescue disk", along with our boot disk at boot time. A rescue disk contains various utilities to fix problems in Linux.

Now that you have created a boot disk using Method #1 or #2, test the boot disk out by rebooting the computer with the disk still in the drive. This is an important step, otherwise you won't know whether it will work when you need it.

If you're locked out of Linux, and require a boot disk to get back in or the boot disk you have doesn't work, this page contains links to pre-made boot disks: http://www.linuxdoc.org/HOWTO/Bootdisk-HOWTO-11.html#ss11.1

If you have access to a DOS machine, I recommend the Small Floppy Rescue System:
http://metalab.unc.edu/pub/Linux/system/recovery/ramf-64.exe

For more information on Linux boot disk or creating your own rescue disk, consult the Linux Bootdisk HOWTO at:
http://www.linuxdoc.org/HOWTO/Bootdisk-HOWTO.html