Floppy Disks in Linux

Floppy Disks in Linux

Chapter 12 describes several ways to access MS-DOS floppy disks under Linux; you can mount the floppy and use Linux commands, or use the mtools utility programs to read from or write to the floppy. You also can create a Linux file system on a floppy disk. In fact, you'll find Linux file systems on the boot and root floppies that you use to install Linux.

Formatting and creating a Linux file system on a floppy is a straightforward process. To format a 3.5-inch high-density floppy in the A drive, for example, use the following command (for more on floppy drive naming conventions, see the 'How to Format a DOS Floppy' section in Chapter 12):

fdformat /dev/fd0H1440

If you have an old PC with a 5.25-inch high-density floppy as the A drive, you can access that floppy with the device name /dev/fd0h1200. On the B drive, change the first 0 in the device name to 1.

Insider Insight 

After you format the floppy, use the following command to create a Linux file system on the floppy:

mke2fs -m 0 /dev/fd0H1440 1440

The -m option is used to specify what percentage of blocks should be reserved for the use of super user (root). By specifying the -m 0 option, you ensure that mke2fs does not reserve space on the floppy disk for the super user. If you do not explicitly specify the -m option, mke2fs reserves five percent of the disk space for the super user.

After you create the file system on the floppy drive, you can mount the floppy at a mount point (an empty directory) in the Linux file system. The following example shows how you mount the floppy drive at the /mnt/floppy directory:

mount /dev/fd0H1440 /mnt/floppy

Now you can use Linux commands, such as cp and mv, to copy or move files to the floppy disk. Before you eject the floppy disk from the drive, use the following command to dismount the floppy:

umount /dev/fd0H1440