Open Source

Configure IT Quick: Create a Linux boot disk with mkbootdisk

Learn how to use the mkbootdisk command to build a basic Linux boot disk.

One of the questions I had when I first started working with Linux was how to create a boot disk as I had done for my Windows machines. While I did learn how to make such a disk during the Red Hat Install process, I still wanted to create an additional boot disk in case something happened to the original. I found that I could do this with the mkbootdisk command. In this article, I will present a step-by-step guide to using mkbootdisk  to create a boot disk for a Linux machine.

Preparing to use mkbootdisk
Since the mkbootdisk command can only be executed from a command prompt, you must be working in a Linux terminal. If you are working from a graphic desktop, such as GNOME or KDE, you will need to open a Terminal Emulation Window. In GNOME, you do this simply by clicking the Terminal Emulation button on the Panel at the bottom of the screen.

You will need to find the kernel number for the version of Linux running on the machine. This number is a required argument for the mkbootdisk command. To find the number, follow these steps:
  1. Type cd /lib/modules at the command prompt.
  2. Press [Enter].
  3. Type ls at the second prompt.
  4. Press [Enter].

You will then see the following displayed in the terminal window:
[UserOne@localhost UserOne]$ cd /lib/modules
[UserOne@localhost UserOne]$ ls

After you enter the ls command, the Linux kernel version number is displayed; in this example, the number is 2.2.12-20. This is the number you will use for the mkbootdisk command.

Log on as root
If you're not already logged on as root, switch to root user with the following commands (you'll need to enter the root password when prompted):
[UserOne@localhost UserOne]$ su root
[root@localhost UserOne]#

The terminal window will display the root command prompt. Make sure that /dev/fd0 is unmounted by entering the mount command with no arguments. If /dev/fd0 is listed as mounted, use the umount command to unmount it like this:
[root@localhost UserOne]# umount /dev/fd0

Create the boot disk
You're now ready to make the boot disk. Label a floppy disk Linux Boot Disk and place it in the drive. (Since mkbootdisk will erase and replace all information on the disk, you don't need to be concerned about the disk format. For this example, I inserted a 1.44-MB IBM PC formatted disk.)

At the root command prompt, enter the mkbootdisk command using the kernel number you obtained above, like so:
[root@localhost UserOne]# /sbin/mkbootdisk 2.2.12-20

(Note that I used the full pathname for the command. Without the full pathname, I received a Command Not Found message.) After pressing [Enter], the following message is displayed:
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press<ENTER> to continue or ^C to abort:

At this point, press [Enter] to confirm. After mkbootdisk copies the kernel and all other necessary programs to the disk, the command prompt will return.

Don’t forget to test your boot disk
The final step to this process is to test the boot disk by rebooting the computer with the disk in the drive. It’s also a good idea to check your boot disks periodically. However, if for some reason you find that you can’t reboot and your boot disk doesn’t work, you may still be able to get your system running using one of the ready-made boot disks found on the Linux Bootdisk HOWTO page.

Linux on the enterprise desktop
For years, enterprises have run Linux on their servers, but few run Linux on their desktops. Do you think this trend will soon change? Why or why not? Post a comment to this article and share your opinion.


Editor's Picks

Free Newsletters, In your Inbox