fdformat Command in Linux



The fdformat command performs the low-level formatting of the floppy disks. Floppy disks are pre-formatted in FAT format for use in MS-DOS and Microsoft Windows. However, floppy disks must be formatted for use on other operating systems, such as Linux.

The low-level formatting, also known as physical formatting, destroys any data on the disk. However, high-level formatting, or logical formatting, creates the filesystem, but it does not destroy the on-disk data.

Table of Contents

Here is a comprehensive guide to the options available with the fdformat command −

Note: The fdformat command is no longer a part of the util-linux package from version 2.41. It has been removed from the package. That is also because the floppy disks are largely obsolete.

Syntax of fdformat Command

The syntax of the Linux fdformat command is as follows −

fdformat [options] [device]

The [options] field is used to specify the options to modify the command behavior. The [device] field is used to specify the floppy disk drive.

Use of fdformat Command

To use the fdformat command on Linux, ensure the util-linux package is installed −

dpkg -l | grep util-linux
Prerequisites to Use fdformat Command

If it is not installed, then install it using the following instructions.

To install the util-linux package on Ubuntu, Debian, and distributions based on them, use −

sudo apt install util-linux

On RHEL, use −

sudo dnf install util-linux

Options of fdformat Command

The options of the fdformat command are listed below −

Options Description
-f N
--form N
It starts the formatting at a specified track (by default it is 0)
-t N
--to N
It stops formatting at a specified track
-r N
--repair N
It tries to repair the tracks by the specified tries
-n
--no-verify
It disables the verification performed after the format
-V
--version
It displays the command version
-h
--help
It displays help related to the command

Examples of fdformat Command in Linux

Lets consider the following examples of the fdformat command in a Linux system −

  • Formatting a Floppy Disk
  • Formatting a Floppy Disk with Specific Starting and Ending Tracks
  • Formatting a Floppy Disk without Verification
  • Repairing the Bad Tracks
  • Changing Formatting Settings

Formatting a Floppy Disk

To format a diskette, use the fdformat command in the following way −

sudo fdformat /dev/fd0

The floppy drives are listed in the form of /dev/fd0, /dev/fd1, and so on. Before performing the format, ensure that the disk is unmounted. To unmount the floppy disk, use the umount command −

sudo umount /dev/fd0

Formatting a Floppy Disk with Specific Starting and Ending Tracks

The format can also be done by specifying the starting and ending tracks. To specify the starting track, use the -f or --form option. Similarly, to specify the ending track, use the -t or --to option −

sudo fdformat -f 0 -t 80 /dev/fd0

Formatting a Floppy Disk without Verification

By default, the fdformat command performs verification. This verification involves a check that each sector reads and writes correctly. It also detects the bad sectors. To skip this step, the -n or --no-verify option is used −

sudo fdformat -n /dev/fd0

Repairing the Bad Tracks

To format the floppy disk and attempt to repair the failed track thrice, use the fdformat command with the -r or --repair option −

sudo fdformat -r 3 /dev/fd0

Changing Formatting Settings

The fdformat command, by default, formats a 3.5-inch double-sided floppy disk with 80 tracks on each side, 18 sectors per track, and a total capacity of 1.44 MB −

sudo fdformat /dev/fd0H1440

These format settings can be modified. It is not a necessary step as the system automatically detects the format settings. Similarly, to format a 360 KB disk, use −

sudo fdformat /dev/fd0D360

Some other formats are listed below −

  • /dev/fd0d360 (minor = 4)
  • /dev/fd0h1200 (minor = 8)
  • /dev/fd0D360 (minor = 12)
  • /dev/fd0H360 (minor = 12)
  • /dev/fd0D720 (minor = 16)
  • /dev/fd0H720 (minor = 16)
  • /dev/fd0h360 (minor = 20)
  • /dev/fd0h720 (minor = 24)
  • /dev/fd0H1440 (minor = 28)
  • /dev/fd1d360 (minor = 5)
  • /dev/fd1h1200 (minor = 9)
  • /dev/fd1D360 (minor = 13)
  • /dev/fd1H360 (minor = 13)
  • /dev/fd1D720 (minor = 17)
  • /dev/fd1H720 (minor = 17)
  • /dev/fd1h360 (minor = 21)
  • /dev/fd1h720 (minor = 25)
  • /dev/fd1H1440 (minor = 29)

In the above format, h/H shows the high density while d/D indicates the double density. After low-level formatting, the disk must be formatted with high-level formatting tools.

Conclusion

The fdformat command in Linux is used to format the diskettes. It is a low-level formatting tool. It is a handy tool to change the default format settings of the floppy disks to make them compatible with the Linux filesystem.

The fdformat command comes with various options to format the floppy disks. This guide discussed the fdformat command, its syntax, options, and usage in Linux through examples.

Advertisements