Device numbers
**************

The floppy device nodes are usually made using the MAKEFLOPPIES shell script (see makefloppies.).

The major device number for the floppy drives is 2.  The minor device number contains describes which drive it represents, and may in addition describe the kind of media which is currently in the drive.

There are two kind of floppy devices:

  * Variable geometry device nodes. Their minor number doesn't depend on the media in the drive, and is calculated as follows:

          MINOR_DEVICE = 128 * FDC_NR + UNIT_NR

  * Fixed geometry device nodes. Their minor number not only depends on the drive which they represent, but also the type of media currently in the drive.  It is computed as follows:

          MINOR_DEVICE = 128 * FDC_NR + UNIT_NR + 4 * FORMAT_NR

In this formula, FDC_NR is the number of the floppy disk controller (0 or 1, usually 0), and UNIT_NR is the Unit number (0 to 3, 0 for Dos drive A:, and 1 for Dos drive B:). FORMAT_NR is only meaningful for the fixed format devices. It describes the disk geometry that is used.  It is an index into the geometry list geometry list.  Using all available controller numbers and all available drive numbers, you may thus connect up to 8 floppy drives to a single Linux box.

Variable format devices
=======================

Variable format devices don't have an intrinsic geometry.  When using these devices, the geometry has to be set either by using autodetection (see Autodetection), or by using the FDSETPRM or FDGETPRM ioctl.  The latter ioctl can be issued using the setfdprm (see setfdprm) and getfdrpm (see getfdprm) programs. With the default settings, common formats are detected transparently, and you can access any disk transparently using the variable format devices.

The geometry information is kept as long as the disk is in the drive, and is discarded as soon as the disk is removed, unless the geometry has been declared permanent by using setfdprm's -p flag (see setfdprm).

Fixed format devices
====================

Fixed format devices should not be used under normal circumstances.

Fixed format devices have an intrinsic geometry.  They are useful for the fdformat program (which is now considered obsolete), and for booting off floppies which have formats that are different from the default format (because during booting, there is no application that can issue the otherwise needed FDSETPRM ioctl).

The geometry list
=================

The floppy driver contains a builtin list of 32 formats.  This list is used for two purposes:

  * It says which geometry is used for the fixed format devices.

  * It is used for autodetection

The following formats (geometries) are known:

format_nr
     Format

0
     autodetect

1
     360KB, 5.25" DD drive

2
     1200KB, 5.25" HD drive

3
     360KB, 3.5" DD drive

4
     720KB, 3.5" DD drive

5
     360KB, 5.25" DD disk in HD drive

6
     720KB, 5.25" DD disk in HD drive

7
     1440KB, 3.5" HD drive

8
     2880KB, 3.5" ED drive

9
     3120KB, 3.5" ED drive

10
     1440KB, 5.25" HD drive

11
     1680KB, 3.5" HD drive

12
     410KB, 5.25" DD disk in HD drive

13
     820KB, 3.5" DD drive

14
     1476KB, 5.25" HD drive

15
     1722KB, 3.5" HD drive

16
     420KB, 5.25" DD disk in HD drive

17
     830KB, 3.5" DD drive

18
     1494KB, 5.25" HD drive

19
     1743KB, 3.5" HD drive

20
     880KB, 5.25" DD drive

21
     1040KB, 3.5" DD drive

22
     1120KB, 3.5" DD drive

23
     1600KB, 5.25" HD drive

24
     1760KB, 3.5" HD drive

25
     1920KB, 3.5" HD drive

26
     3200KB, 3.5" ED drive

27
     3520KB, 3.5" ED drive

28
     3840KB, 3.5" ED drive

29
     1840KB, 3.5" HD drive

30
     800KB, 3.5" DD drive

31
     1600KB, 3.5" HD drive

This table lists first the format_nr (0-31) used to compute the minor number, then the capacity of the format (360KB - 3200KB), and then the type of the drive in which this format is used.

The formats 0..8 are the standard PC formats.  The remaining formats are extended capacity formats. Some of them have been taken from Heiko Schroeder's fdpatches (after correcting some minor bugs).  Others have been added by David Niemi and me (Alain Knaff).  Formats 9, 12, 13, 16, 17, 30 and 31 are non-interleaved formats with normal sized sectors, and have the highest capacity that can be achieved without resorting to interleaving or bigger sectors (More sectors).  Formats 10, 11, 14, 15, 18, 19 use interleaving interleaving to achieve a higher capacity (Interleave).  Formats 20 and 22 to 29 use bigger sectors than usual (Larger sectors and Mixed size sectors).

In addition to these techniques, formats 13-19 use more cylinders than usual (More cylinders).  USE THESE FORMATS (13-19) ONLY IF YOUR DRIVE SUPPORTS THE NECESSARY NUMBER OF TRACKS

Adding new formats
==================

You can redefine the default formats using the setfdprm program (setfdprm)  (In that case, the MAKEFLOPPIES program (makefloppies) no longer works to generate a correct name for these formats, and you have to make them manually.).  The following example illustrates how to add a new 19 sector format, and make a device entry for it.  First, we pick an entry for it, which we want to reuse. I recommend to redefine an entry which is only rarely used.  For instance, if you have no 5 1/4 drive on your system, you can redefine any 5 1/4 entry without a loss.  In our example, we pick 10.

First we make the device node:

     mknod /dev/fd0H1520 b 2 40
              ^          ^ ^  ^
              |          | |  Minor device number (format number * 4 +
              |          | |                       drive + controller*128)
              |          | Major device number (always 2!)
              |          Blockdevice
         A name that you choose for the format. I
         recommend to base the name on the capacity,
         but you may choose any name you want.

Then we redefine the geometry of the new device:

     setfdprm /dev/fd0H1520 1520 19 2 80 0 0x1b 0 0xcf 0x6c

NB: This redefines the geometry for any device node with the same format number, not just the new node.

The new geometry is only valid until the next reboot (or removal of the floppy module).  In order to make it permanent, you have to execute the setfdprm command from your /etc/rc file or whenever you insert the floppy module.