fdutils - phpMan

Command: man perldoc info search(apropos)  


File: fdutils.info,  Node: Top,  Next: Location,  Prev: (dir),  Up: (dir)

Introduction
************

Fdutils is a collection of utililties for configuring and using the
Linux floppy driver.  With fdutils, you can:

  1. Format disks with a higher capacity than usual (up to 1992KB on a
     3 1/2 HD disk).

  2. Reconfigure the autodetection sequence to automatically detect
     some of these extended formats.

  3. Access various internal driver structures and drive configuration
     using the floppycontrol program.

   This manual describes these utilities, and also the floppy driver
itself.

* Menu:

* Location::                   Where to get fdutils and its documentation
* Basic usage::                How to get started
* Device numbers::
* Media description::          How can a floppy disk and a format be described
                               to fdutils?
* Drive descriptions::         How can a drive and its characteristics be
                               described to fdutils?
* Extended formats::           How to store more data on your floppy disks
* Autodetection::              How the floppy driver distinguishes among the
                               different kinds of disks
* Boottime configuration::     Lilo boot options understood by the floppy driver
* Floppy ioctls::              The ioctl's understood by the floppy driver
* Commands::                   The available fdutils commands
* Compile-time configuration:: How to use GNU autoconf to customize fdutils
* Acronyms::                   A brief listing of acronyms used in this
                               documentation
* Interesting formats::        A brief list of legacy and other formats
* Command Index::              Command Index
* Concept Index::              Concept Index

File: fdutils.info,  Node: Location,  Next: Basic usage,  Prev: Top,  Up: Top

Where to get fdutils and its documentation
******************************************

Fdutils can be found at the following places (+ mirrors):
     ftp://www.tux.org/pub/knaff/fdutils/fdutils-5.4.tar.gz
     ftp://metalab.unc.edu/pub/Linux/utils/disk-management/fdutils-5.4.tar.gz
     ftp://tsx-11.mit.edu/pub/linux/sources/sbin/fdutils-5.4.tar.gz

   The FAQ included in this package is also available separetely at:
     http://alain.knaff.linux.lu/floppy/FAQ.html
     http://www.tux.org/pub/knaff/floppy/FAQ.html
   The FAQ at fdutils.linux.lu and www.tux.org is usually more up to
date than versions found elsewhere.  Thus, if you don't find an answer
in the copy of the FAQ you have, please check this one for more recent
info.

   Before reporting a bug, make sure that it has not yet been fixed in
the Alpha patches which can be found at:
     http://fdutils.linux.lu
     ftp://www.tux.org/pub/knaff/fdutils

   These patches are named `fdutils-'VERSION`-'DDMM`.taz', where version
stands for the base version, DD for the day and MM for the month. Due
to a lack of space, I usually leave only the most recent patch.

   There is an fdutils mailing list at fdutils @ www.tux.org .  Please
send all bug reports to this list.  You may subscribe to the list by
sending a message with 'subscribe fdutils @ www.tux.org' in its body to
majordomo @ www.tux.org . (N.B. Please remove the spaces around the "@"
both times. I left them there in order to fool spambots.)
Announcements of new fdutils versions will also be sent to the list, in
addition to the linux announce newsgroups.  The mailing list is
archived at http://www.tux.org/hypermail/fdutils/latest

File: fdutils.info,  Node: Basic usage,  Next: Device numbers,  Prev: Location,  Up: Top

Basic usage
***********

This chapter describes basic usage of floppies, and gives a few simple
tips for using floppies under Linux.

* Menu:

* Disk organisation   :: How a disk is organized, high-level and low-level
                         formats
* File systems        :: Which file systems does Linux support
* Device names        :: How floppy drives are named
* Identifying disks   :: How to identify a disk
* Nickel tours        :: Short summaries of the various storage methods
* New features        :: New features of the kernel, mtools, and fdutils

File: fdutils.info,  Node: Disk organisation,  Next: File systems,  Prev: Basic usage,  Up: Basic usage

How disks are organized
=======================

All floppies have two levels of _formatting_, both of which must be
known in order to read them.  The first is the _binary_ or _sector_
level format, which is how raw data is stored on the disk.  The second
is a higher level organization, often called a _file system_, which
allows multiple files to be conveniently stored on the disk.

   For example, a typical 1.44MB disk contains a low-level format, with
18 sectors per track, 80 tracks, and two sides (or heads); each sector
can hold 512 bytes of data for a total of 1474560 bytes (or 1440 KB).
When used under MS-DOS, this floppy would have a small portion of the
disk used to keep track of files on the disk (including a bootsector,
file allocation tables, directories, etc.).

   The floppy driver generally takes care of reading the binary, or
low-level format.  It can often "guess" the low-level disk geometry
needed to read the disk.  This is called autodetection (*note
Autodetection::).  If the driver can't autodetect the disk (e.g. if it
is in an unusual format) you can tell the driver what the geometry is
either by using the `setfdprm' (*note setfdprm::) utility or by using a
fixed geometry device device (e.g. `/dev/fd0H1440').

   Under Linux, many different file systems from many sources can be
used.  Some of these file systems are interpreted via a utility program
(for example `mtools' for using disks with an MS-DOS file system).  Many
file systems can alternatively be "mounted" to appear in the UNIX
directory structure until subsequently being unmounted; this is usually
implemented by having the kernel itself interpret the file system on the
disk.

File: fdutils.info,  Node: File systems,  Next: Device names,  Prev: Disk organisation,  Up: Basic usage

File systems supported by Linux
===============================

The following file systems are supported:

*OS/2 HPFS:*
     read-only support (mount/kernel)

*Mac HPFS 1.44MB:*
     read-only (xhfs utility)

*MS-DOS:*
     read, write, format (mtools utility _and_ mount/kernel)

*tar, cpio:*
     compatible with many variations of UNIX (tar, cpio utilities)

*System V, minix, xia, ext, ext2:*
     (mount/kernel)

*pure binary disk access:*
     no file system (any program, usually dd, cat, and cp)

File: fdutils.info,  Node: Device names,  Next: Identifying disks,  Prev: File systems,  Up: Basic usage

What's in a name
================

The following figure shows the meaning of the different parts of the
name of a floppy device:

      +--------------- /dev: directory for devices
      |   +------------- fd: floppy disk device prefix
      |   | +------------ 0: floppy drive #0 (A:) (0-1 typical, 0-7
      |   | |                possible)
      |   | |+-- 3.5" drive: (use d for 5.25" double density drives, and
      |   | ||                    h for 5.25" high density drives,
      |   | ||                    u for 3.5" drive of any density)
      |   | ||   +---- 1440: Capacity (in KB) of format (usually between
      |   | ||   |           360 and 3920)
     /dev/fd0u1440

File: fdutils.info,  Node: Identifying disks,  Next: Nickel tours,  Prev: Device names,  Up: Basic usage

What to do if you get an unidentified floppy disk
=================================================

     dd if=/dev/fd0 of=/tmp/foo count=1
             # If it works:
     getfdprm                # This will report what geometry the disk has
     file /tmp/foo           # This may indicate the type of file system
     mdir a:                 # Check for an MS-DOS file system
     tar tvf /dev/fd0        # Check for a tar archive
     cpio -itv < /dev/fd0    # Check for a cpio archive
     e2fsck /dev/fd0         # Check for an "ext2" file system
             # If it doesn't work:
             # Try the above dd command using various /dev/fd0* devices

File: fdutils.info,  Node: Nickel tours,  Next: New features,  Prev: Identifying disks,  Up: Basic usage

Nickel tours
============

* Menu:

* Mtools             :: Access MS-Dos disks from Unix
* Tar                :: Tarring files directly to floppy disks
* CPIO               :: Another archive format
* Ext2               :: Seconded Extended File System

File: fdutils.info,  Node: Mtools,  Next: Tar,  Prev: Nickel tours,  Up: Nickel tours

mtools
------

     mdir a:                # Read directory of MS-DOS disk in drive A:
     mcopy /tmp/foo\* a:    # Copy files beginning with foo in /tmp to A:
     mcopy a:\* .           # Copy all files from A: to current directory
     mformat a:             # Add MS-DOS file system to formatted disk

File: fdutils.info,  Node: Tar,  Next: CPIO,  Prev: Mtools,  Up: Nickel tours

Tar (Tape ARchive)
------------------

     tar tvf /dev/fd0              # Read directory of tar archive in
                                   # drive A:
     tar cvf /dev/fd0 foo1 foo2    # Write foo1 and foo2 to A: in tar
                                   # format foo1/foo2 can be entire
                                   # directory trees
     tar xvfp /dev/fd0             # extract entire tar archive in
                                   # drive A:

   Tar is not a file system.  Only low-level format (`superformat',
*note superformat::) are needed to prepare a disk to accept a tar
archive.

File: fdutils.info,  Node: CPIO,  Next: Ext2,  Prev: Tar,  Up: Nickel tours

CPIO (CoPy In/Out)
------------------

     cpio -itv < /dev/fd0        # Read directory of cpio archive in A:
     find foo1 foo2 -print | cpio -ov < /dev/fd0
                                 # Write foo1/foo2 to A:
                                 # foo1/foo2 can be entire directory trees
     cpio -idumv < /dev/fd0      # extract entire CPIO archive in drive A:

   Note: blocks reported are in 512-byte units (due to UNIX System V
heritage).  Cpio is not a file system.  Only low-level format (fdformat
or superformat (*note superformat::) needed.

File: fdutils.info,  Node: Ext2,  Prev: CPIO,  Up: Nickel tours

Ext2 (Second Extended File System)
==================================

     mke2fs /dev/fd0 1440          # Makes an ext2 filesystem of 1440
                                   # block on A:
     mke2fs -c /dev/fd0 1440       # Same as above, but tests floppy first
     e2fsck /dev/fd0               # Tests filesystem integrity. (like
                                   # chkdsk in Dos)
     e2fsck -p /dev/fd0            # Repairs filesystem. (like chkdsk /f
                                   # in Dos)
     mount -t ext2 /dev/fd0 /mnt   # Mounts the disk in A: on /mnt.
                                   # The directory /mnt must already exist
     umount /mnt                   # Unmounts /mnt. No process should
                                   # have its working directory in /mnt
                                   # No process should have open files in
                                   # /mnt

   Note: don't use ext2 on 2m disks On some systems `mke2fs' is also
called mkfs.ext2, and e2fsck is also called fsck.ext2

File: fdutils.info,  Node: New features,  Prev: Nickel tours,  Up: Basic usage

New Features of 1.2+ kernels
============================

* Menu:

* kernel                 :: New kernel features since 1.2.0
* mtools                 :: New mtools features since mtools-3.0
* fdutils                :: Utilities contained in the fdutils package

File: fdutils.info,  Node: kernel,  Next: mtools,  Prev: New features,  Up: New features

New features of 1.2+ kernels
----------------------------

   * Faster and more comprehensive automatic sensing of floppy formats

   * Second Floppy Disk Controller (FDC) supported

   * DOS fdformat-style formats (up to 21 sectors on HD 3.5" disk)

   * DOS 2m-style formats (up to 24 sectors equivalent on HD 3.5" disk)

   * non-DOS 2m-inspired formats

   * Several long-standing bugs fixed

   * More exact detection of FDC type

   * More exact detection of floppy drives

File: fdutils.info,  Node: mtools,  Next: fdutils,  Prev: kernel,  Up: New features

New features of mtools-3.0
--------------------------

   * Support for new floppy formats (fdformat, 2m, 2m-like, ED)

   * 2.88MB (Extra Density) floppies supported

   * More friendly syntax (e.g. "mcopy a:", "mmove")

   * Improved mmount

   * 16-bit FATs (needed for some ED formats)

   * Automatically sets disk geometry for Linux

   * Several bug fixes

   NOTE: Mtools has no longer maintained by its original maintainer
Emmet P. Gray after 2.0.7.

File: fdutils.info,  Node: fdutils,  Prev: mtools,  Up: New features

New Utilities
-------------

   * `superformat' (replaces fdformat; up to 3.84 MB floppies, faster,
     calls mformat)

   * new `getfdprm'/`setfdprm'

   * `fdrawcmd' (allows user-mode programs to do low-level floppy
     actions) `floppycontrol' (general-purpose floppy driver
     configuration utility)

   * `MAKEFLOPPIES' (makes floppy devices)

File: fdutils.info,  Node: Device numbers,  Next: Media description,  Prev: Basic usage,  Up: Top

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

The floppy device nodes are usually made using the `MAKEFLOPPIES' shell
script (*Note 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_ *Note 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.

* Menu:

* Variable format devices::
* Fixed format devices::
* geometry list::
* Adding new formats::

File: fdutils.info,  Node: Variable format devices,  Next: Fixed format devices,  Prev: Device numbers,  Up: Device numbers

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
(*note Autodetection::), or by using the `FDSETPRM' or `FDGETPRM'
ioctl.  The latter ioctl can be issued using the `setfdprm' (*note
setfdprm::) and `getfdrpm' (*note 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 (*note
setfdprm::).

File: fdutils.info,  Node: Fixed format devices,  Next: geometry list,  Prev: Variable format devices,  Up: Device numbers

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).

File: fdutils.info,  Node: geometry list,  Next: Adding new formats,  Prev: Fixed format devices,  Up: Device numbers

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 (*Note More sectors::).  Formats 10, 11,
14, 15, 18, 19 use interleaving interleaving to achieve a higher
capacity (*Note Interleave::).  Formats 20 and 22 to 29 use bigger
sectors than usual (*Note Larger sectors:: and *Note Mixed size
sectors::).

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

File: fdutils.info,  Node: Adding new formats,  Prev: geometry list,  Up: Device numbers

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

You can redefine the default formats using the setfdprm program (*Note
setfdprm::) (1).  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

   *Note:* 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.

   ---------- Footnotes ----------

   (1) In that case, the `MAKEFLOPPIES' program (*Note makefloppies::)
no longer works to generate a correct name for these formats, and you
have to make them manually.

File: fdutils.info,  Node: Media description,  Next: Drive descriptions,  Prev: Device numbers,  Up: Top

Media description
*****************

* Menu:

* Media Introduction      :: Benefits of the new representation
* Syntax                  :: What a media description looks like
* Media definition file   :: Refer to media by a symbolic name

File: fdutils.info,  Node: Media Introduction,  Next: Syntax,  Prev: Media description,  Up: Media description

Media Description Introduction
==============================

Fdutils-5.0 introduces a new uniform format description, which is
supported both by setfdprm and superformat.  The new format description
is easyer to handle, because it allows to set the different parameters
of a format description in a symbolic and position independant way,
using a series of _variable=value_ clauses.  Moreover, it automatically
fills in sensible default values for unspecified parameters.  Thus you
only need to describe those aspects of the format that are important to
you, and let the system handle the others.

   Moreover, the new description separates those aspects that were
specific to the drive (like for instance its rotation speed) from those
that are specific to the media (spacial density, number of sectors,
etc.).

   The same description can be used both by setfdprm and superformat:
     setfdprm /dev/fd0 hd sect=21 cyl=83
     superformat /dev/fd0 hd sect=21 cyl=83

   The first line above configures a 21 sector/83 cylinder format for
drive 0, and the second line formats a disk using this same format.

File: fdutils.info,  Node: Syntax,  Next: Media definition file,  Prev: Media Introduction,  Up: Media description

Syntax
======

A media description is a series of _variable=value_ and _selector_
clauses. _Value_ is a number followed by an optional unit.  The unit is
either `KB' (1024 bytes) or `b' (blocks of 512 bytes), or none (bytes).

* Menu:

* Selecting the density                               ::
* Selecting the number of cylinders heads and sectors ::
* Selecting non-standard sector sizes                 ::
* Legacy formats                                      ::
* Expert options                                      ::

File: fdutils.info,  Node: Selecting the density,  Next: Selecting the number of cylinders heads and sectors,  Prev: Syntax,  Up: Syntax

Selecting the density
---------------------

To select a density just insert its two letter code into the format
description.  Selecting a density also selects its default number of
sectors, heads and cylinders.  However, these latter parameters can be
overridden.

`hd'
     High density (1440KB for 3 1/2 and 1200KB for 5 1/4).  The most
     commonly used format today.

`dd'
     Double density (720KB for 3 1/2 and 360KB for 5 1/4)

`ed'
     Extra density (2880KB for 3 1/2)

`qd'
     Quad density (720KB for 5 1/4).

`sd'
     Single density (no nominal size).  Used mostly for CP/M.  Only for
     experienced users.

   If no density is given, the maximal density supported by the drive is
used.  However, in order to keep the drive description and the media
description independent, I strongly suggest that you *always* indicate
the density anyways.

File: fdutils.info,  Node: Selecting the number of cylinders heads and sectors,  Next: Selecting non-standard sector sizes,  Prev: Selecting the density,  Up: Syntax

Selecting the number of cylinders, heads and sectors
----------------------------------------------------

This subsection describes how to select custom formats with a
non-standard number of heads, cylinders or sectors.  However, note that
just describing the number of sectors, heads and cylinders is not
enough: you also need to indicate which density your custom format is
based on (cf. previous section).

`sect=_nb_of_sectors_'
     This describes the number of sectors.

`head=_nb_of_heads_'
     This describes the number of heads to be used.

`cyl=_nb_of_cylinders_'
     This described the number of cylinders to be used.

File: fdutils.info,  Node: Selecting non-standard sector sizes,  Next: Legacy formats,  Prev: Selecting the number of cylinders heads and sectors,  Up: Syntax

Selecting non-standard sector sizes
-----------------------------------

In order to achieve a higher capacity, you may want to use a bigger
sector size.

`ssize=_sector_size_'
     Choses a bigger sector size.  The sector size is expressed in
     bytes.  Only powers of two between 128 and 32768 are acceptable

`sect=_nb_of_sectors_'
     Describes the number of sectors.  For example `hd sect=11
     ssize=1024' describes a format where one track (1 side) is made up
     of 11 sectors of 1024 bytes each (thus 11KB per track, and 22KB
     per cylinder).

`tracksize=_size_of_one_track_'
     Describes the size of one track.  For example, `hd tracksize=11KB
     ssize=1KB' describes a format where one track contains 11KB of data
     (tracksize) stored in sectors of 1KB each.

     This option exists mainly to describe MSS (mixed sector size)
     formats.  For example, `hd tracksize=12KB mss' describes a format
     where one track which contains 12 KB of data.  The sectors size
     are chosen by the system in a way to take up the least raw space:
     8KB + 4KB.

`mss'
     This option says that the format is an MSS format.

`2m'
     This option says that the format is a so-called 2M format.  These
     formats are intended for easy readability on DOS boxes.  Their
     first track has the usual 18 sectors, whereas the other tracks
     have bigger sector, and in some cases mixed sector sizes.


File: fdutils.info,  Node: Legacy formats,  Next: Expert options,  Prev: Selecting non-standard sector sizes,  Up: Syntax

Legacy formats
--------------

The `swapsides' format allows to descibe disks whose sides are swapped,
such as CBM1581 disks.

File: fdutils.info,  Node: Expert options,  Prev: Legacy formats,  Up: Syntax

Expert options
--------------

The following options are not needed in most common situations, as they
are implied by the _density_ selector.  They may be needed to read some
legacy (CP/M) formats.

`tpi=48'
     For 5 1/4 disks only.  This says that the format uses double-spaced
     cylinders (implied by double density).

`tpi=96'
     For 5 1/4 disks only.  This says that the format uses single-spaced
     cylinders (implied by quad and high density).

`fm=0'
     Uses MFM encoding (implied by double, quad, high and extra density)

`fm=1'
     Uses FM encoding (implied by single density)

`dtr=_dtr-code_'
     Sets the data transfer rate.  The following table lists the dtr
     codes for various transfer rates:
          dtr-code    rate for FM          rate for MFM
          =============================================
          0           250kb/s              500kb/s
          1           150kb/s              300kb/s
          2           125kb/s              250kb/s
          3           500kb/s              1000kb/s

`perp=0'
     Do not use "perpendicular mode" sector headers (this setting is
     implied by single, double, quad and high density).

`perp=1'
     Use "perpendicular" sector headers (this setting is implied by
     extra-density)

`gap=_value_'
     Sets the size of the read/write gap.  I don't know the purpose of
     this parameter (which is passed _as-is_ to the floppy controller):
     any value seems to work with any format...

`fmt_gap=_value_'
     Sets the size of the formatting gap.  This is only used by the now
     obsolete `fdformat' program, and not by superformat.

File: fdutils.info,  Node: Media definition file,  Prev: Syntax,  Up: Media description

The media description dictionary in /etc/fdmediaprm
===================================================

`/usr/local/etc/fdmediaprm' (1) contains a dictionary of commonly used
media descriptions.  Each description is identified by a name, which
can then be used by setfdprm or superformat to refer to it, instead of
an explicit description.

   Each definition starts with `"'_name_`":', followed by the actual
description.  Definitions may be spread over several lines, for better
readability.  The file may contain comments, which start with # and
stop at the end of the line.

   ---------- Footnotes ----------

   (1) The actual location of this file depends on the value of the
`sysconfdir' compile time configuration variable (*note Compile-time
configuration:: for details)

File: fdutils.info,  Node: Drive descriptions,  Next: Extended formats,  Prev: Media description,  Up: Top

Drive descriptions
******************

Unlike earlyer version, fdutils-5.0 separates drive descriptions and
media description.  For more details on this separation, *note Media
Introduction::.  Drive descriptions are used to describe the hardware
characteristics of a drive, such as their maximal density, their
rotation speed, their form factor, etc.

* Menu:

* Syntax of a drive description      :: What to put into a drive description
* Drive definition file              :: Where drive definitions are stored

File: fdutils.info,  Node: Syntax of a drive description,  Next: Drive definition file,  Prev: Drive descriptions,  Up: Drive descriptions

Syntax
======

A drive description is a series of _variable=value_ and _selector_
clauses.

* Menu:

* Density               :: The maximal available density on the drive
* Form factor           :: Whether this drive is a 3 1/2", 5 1/4" or 8" drive
* Cmos code             :: Sums up both density and form factor
* Other parameters      :: Rotation speed and tracks per inch

File: fdutils.info,  Node: Density,  Next: Form factor,  Prev: Syntax of a drive description,  Up: Syntax of a drive description

Density
-------

The density of a drive is the highest media density that it supports.
Density is one of `sd', `dd', `qd', `hd' or `ed'.  Usually, you do not
need to specify this parameter, as it can be derived from the drives
CMOS code.

File: fdutils.info,  Node: Form factor,  Next: Cmos code,  Prev: Density,  Up: Syntax of a drive description

Form factor
-----------

The form factor of a drive describes the physical dimensions of the
media it accepts.  It is one of `3.5', `5.25' or `8'.  Usually, you do
not need to specify this parameter, as it can be derived from the
drives CMOS code.

File: fdutils.info,  Node: Cmos code,  Next: Other parameters,  Prev: Form factor,  Up: Syntax of a drive description

Cmos code
---------

The PC Bios already knows on its own about the most common drive types.
These are named by an integer from 1 to 6, according to the following
table.
     0        no drive installed
     1        5.25 DD
     2        5.25 HD
     3        3.5 DD
     4        3.5 HD
     5        3.5 ED
     6        3.5 ED

   As you see 3.5 ED drives have two possible codes.  Some BIOSes use 5,
others use 6.  The reason for this is that initially 5 was intended for
floppy tape drives, and only 6 was for 3.5 ED drives.  However, some
BIOS manufacturers didn't know about this convention, and used 5 for the
then "new" 3.5 ED drives.

   Usually, you do not need to specify this parameter, as it can be read
from the physical CMOS of your PC.  This parameter may be useful if your
BIOS does not store the drive's CMOS code at the expected place, or if
you have more than two drives.

File: fdutils.info,  Node: Other parameters,  Prev: Cmos code,  Up: Syntax of a drive description

Other parameters
----------------

`deviation=DEVIATION'
     Tells how much more/less raw capacity the drive has than the
     standard.  Due to slightly different rotation speeds (1) and to
     slightly different data transfer rates, the raw capacity per track
     can vary slightly.  For normal formats, these small deviations
     from the prescribed raw capacity is not harmful, as these have
     plenty of safety margins built in.  However, the new extra
     capacity formats are affected by this, as they try to squeeze
     every available raw byte out of the disk.

     Deviation is expressed in ppm.  Positive values mean a higher raw
     capacity than normal, and negative values mean a lower raw
     capacity than normal.  The deviation can be measured using the
     `floppymeter' program.

`rpm=ROTATION_SPEED'
     Prescribed rotation speed of the drive, expressed in rotations per
     minute.  This is 360 for 5 1/4 HD drives, and 300 for all other
     commonly available drive types.  Usually, you do not need to
     specify this parameter, as it can be derived from the drive's CMOS
     code.  It is useful however for single density drives or other
     drives not commonly found on a PC.  Usually, you do not to specify
     this parameter, as it can be derived from the drive's form factor
     and maximal density.

`tpi=CYLINDER_DENSITY'
     This parameter is only meaningful for 5 1/4 drives.  It expresses
     whether the drive is able to use 80 tracks (`tpi=96') or only 40
     (`tpi=48').  Usually, you do not to specify this parameter, as it
     can be derived from the drive's maximal density: quad density and
     high density drives are 96 tpi, whereas double density drives are
     48 tpi.


   ---------- Footnotes ----------

   (1) drives do not always rotate at exactly 5 or 6 rotations per
second, but some may be slightly faster or slightly slower than spec

File: fdutils.info,  Node: Drive definition file,  Prev: Syntax of a drive description,  Up: Drive descriptions

The drive definition file in `/usr/local/etc/fddriveprm'
========================================================

`/usr/local/etc/fddriveprm' (1) contains a dictionary of commonly used
media descriptions.  Each description is identified by a name, which
can then be used by setfdprm or superformat to refer to it, instead of
an explicit description.

   Each definition starts with `"drive'_number_`":', followed by the
actual description.  Definitions may be spread over several lines, for
better readability.  The file may contain comments, which start with #
and stop at the end of the line.

   ---------- Footnotes ----------

   (1) The actual location of this file depends on the value of the
`sysconfdir' compile time configuration variable (*note Compile-time
configuration:: for details)

File: fdutils.info,  Node: Extended formats,  Next: Autodetection,  Prev: Drive descriptions,  Up: Top

Storing more data on a floppy disk
**********************************

This section describes the techniques that are used by Linux' floppy
driver and superformat to store more data than usual on a floppy disk.

   Each section contains a description of the technique used, lists the
usages of the disks formatted using this technique (whether they are
bootable, whether they are accessible on MS-DOS and for which kind of
filesystems they are suitable) and finishes with a table listing the
most interesting formats which can be obtained by the described
technique.

   The table lists for each format the media type it is used for, the
total capacity which can be achieved, the throughput for large reads or
writes and the media description for these disks.  This description can
the be used with superformat to make such disks, or with setfdprm to
configure the drive to read/write to them.  Some formats (the XDF and
XXDF formats) cannot be accessed directly, and thus there is no media
description for them.  For these, we indicate a formatting command used
to make these disks.  The formatting command assume that the disk is in
the first drive (`/dev/fd0').  Substitute `/dev/fd1' if you want to
format XDF or XXDF disks in the second drive.

* Menu:

* More sectors::          Using more sectors per track by packing them
                          close together
* Interleave::            Use interleave to pack the sectors even closer
                          together
* Sector skewing::        Speeding up multi-track reads
* More cylinders::        Use up to 83 cylinders
* Larger sectors::        Minimize per byte overhead by using larger sectors
* Mixed size sectors::    Minimize slack by using several sector sizes
                          in a same track
* Smart use of the dtr::  How to get more out of your disk by playing games
                          with the data transfer rate
* 2M::                    Make autodetection easyer by using a readable
                          first track
* XDF::                   Fast high capacity formats
* XXDF::                  Fast formats with even higher capacity

File: fdutils.info,  Node: More sectors,  Next: Interleave,  Prev: Extended formats,  Up: Extended formats

More sectors per cylinder
=========================

The official formats used by MS-DOS and other operating systems are
generally very conservative.  It is often possible to fit more sectors
on each track than the default by simply reducing the size of the gap
between tracks and/or the size of the leftover space at the end of the
disk.

   For example, a 3 1/2 disk has a raw track capacity of around 12500
bytes.  The raw capacity of a floppy disk is not rigorously constant
among different boxes, because both the data transfer rate of the floppy
controller, and the rotation speed of the drive are subject to small
variations.  In order to account for these, we have to use a safety
margin, and we only use up 12450 bytes of the 12500 bytes that are
theoretically available.

   A sector contains a header of 62 bytes and 512 bytes of data.  A
minimum gap of about 45 bytes should be used in order to leave enough
time to the floppy controller to "rest" between reading two successive
sectors.  In total, 619 bytes per sector are thus needed.

   This shows that we can fit 12450 / 619 = 20 sectors per track.

   *Usage:* These disks are bootable by Lilo, and can be read in MS-DOS
using numerous shareware utilities such as `vgacopy', or `fdformat' or
many others.  Check your nearest Simtel mirror.

   With dos6, you don't need any add-on utilities, just put the
following line in your `config.sys':

     drivparm=/d:0 /f:7 /h:2 /s:21 /t:82
                 ^    ^ \______________/
                 |    |          |
        drive number  |     max geometry
                      |
           drive type, consult the dos help system for details

   *Interesting Formats:*

     density     tot. cap.    throughput    media description
     5 1/4 DD     800KB        30KB/s       dd sect=10
     3 1/2 DD     800KB        25KB/s       dd sect=10
     3 1/2 HD    1600KB        50KB/s       hd sect=21
     3 1/2 ED    3200KB       100KB/s       ed sect=42

   The `--dd', `--hd' and `--ed' options describe the density of the
media to be formatted (double density, high density or extra density).

   The `-s' options describes the number of 512 byte sectors per track.

File: fdutils.info,  Node: Interleave,  Next: Sector skewing,  Prev: More sectors,  Up: Extended formats

Using interleave
================

After having read a sector, the floppy controller needs to "rest" for a
short time.  This time is used to compute checksums, to reset internal
circuitry, etc.  During this time, the floppy disk continues to rotate,
and the "rest" time thusly translates to a certain minimal gap size.  If
a smaller gap is used, the next sector header flies by the read-write
head before the floppy controller is ready again to pick up the data.
Thus, it has to wait until the next disk rotation until that sector
comes back again.  This leads to an unacceptably low throughput, as now
the system can only read one sector per rotation instead of all sectors
in one rotation.  If we want to use smaller gaps, we have thus to use
_sector interleaving_.  This technique consists in arranging the
sectors in a way such that the next logical sector does not immediately
follow the current sector, but instead another sector is inserted
between two successive sectors.  Instead of having the following order:
     1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21

   we would use the following order:

     1,12,2,13,3,14,4,15,5,16,6,17,7,18,8,19,9,20,10,21,11,

   This new order allows the floppy controller to rest during the whole
time that sector 12 flies by between reading sector 1 and 2.  This
technique still cuts throughput in half, because two rotations are
needed (one for reading sectors 1 to 11, and the second to read sectors
12 to 21).  However, this is far better than the 21 rotations which
would be needed without interleave.

   This technique allows us to use a gap size of just 1, and thus fit 21
sectors on one track.

   *Usage:* Once formatted, interleaved disks can be used in a similar
way to disks which have simply more tracks.  They can be accessed using
`vgacopy' in Dos, you can boot from them using Lilo, and you may
install any filesystem on them.

   *Interesting Formats:*

     density     tot. cap.    throughput    media description
     5 1/4 HD    1440KB        27KB/s       hd sect=18
     3 1/2 HD    1680KB        26KB/s       hd sect=21
     3 1/2 ED    3360KB        52KB/s       ed sect=42

   You don't need to tell `superformat' to use interleaving, it figures
out by itself when interleaving is needed.  You don't need to tell
`setfdprm' either that a disk is interleaved, as this information is
not needed to read the disk

File: fdutils.info,  Node: Sector skewing,  Next: More cylinders,  Prev: Interleave,  Up: Extended formats

Sector skewing
==============

Sector skewing is a technique that allows bigger throughputs.  It does
not increase the capacity of the disk. Sector skewing is only relevant
during formatting. Sector skewed disks are indistinguishable from
non-skewed disk by software, except for a different throughput.

   The principle of sector skewing is to start each track a little bit
later than the previous one, i.e. the first logical sector of the second
cylinder would for exemple lie near the sixth logical sector of the
first cylinder.  This is done in order to account for the time needed to
seek the drive head from the first cylinder to the second.  Without
skewing, the first sector would already have passed the drive head after
seeking, and we would need to wait for a whole rotation for it to come
back again.

   By default, superformat applies appropriate skewing to all formats,
and the listed throughput values refer to skewed disks. It is possible
to provide different values for the skew using the `--head_skew' and
`--track_skew' parameters. `head_skew' refers to the offset between
both sides of the same cylinder, and `track_skew' refers to the offset
of two consecutive cylinders. 0 means no skew.

File: fdutils.info,  Node: More cylinders,  Next: Larger sectors,  Prev: Sector skewing,  Up: Extended formats

More Cylinders
==============

Many nominally 40-cylinders or 80-cylinder drives are capable of more
cylinders, usually 41 and 83 respectively.  These can be used to get
extra capacity.  However, not all drives can seek to these unofficial
extra cylinders, and even on drives which can, these extra cylinders
tend to be less reliable.

   *WARNING*: Although most drives are able to use 83 cylinders, some
may not.  If your drive is making strange noises while accessing these
tracks.

   Although most drives support more than 80 tracks, I have heard rumors
that some do not, and repeatedly trying to read beyond track 80 might be
damaging to them.  In order to know wether your drive supports more than
eighty tracks, first set the number of allowed tracks to 82.  (using
`floppycontrol --cylinders 82 -d 'DRIVE)

   Then format a disk with a 82 track format (for example
`/dev/fd0H1722'), and copy on or several files to the disk until there
are less than 18 KB of free space on the disk.  Then eject and reinsert
the disk, and compare the files on the disk with the originals. If they
are the same, your drive does support 82 tracks. If so, you might want
to go further and try with 83 cylinders: `/dev/fd0H1743') This single
experience should not damage the drive, although repeating it many
times may be dangerous.

   If you do have a drive which supports more than 80 cylinders, you
have to call `floppycontrol --cylinders 82 DRIVE' before you can use
the extra cylinders.  You may put this line into your `/etc/rc.local',
so that the driver is automatically configured for the addition
cylinder after each boot.

   If on the other hand your drive doesn't support more than 80 tracks,
you should remove the entries for formats 13-19 from your `/dev'
directory after running `MAKEFLOPPIES', and you should call
`floppycontrol --cylinder 80 DRIVE' from your `/etc/rc.local' (or
`floppycontrol --cylinder 40 DRIVE' for 5 1/4 DD drives).

   By default, 83 cylinder are enabled for any high density and double
density drives.  3 1/2 double density drives have 80 cylinders enables,
and 5 1/4 double density drives have 40 enabled.

   *Usage:* These disks can be booted from using LILO, and can be
accessed in MS-DOS using `vgacopy'.

   *Interesting Formats:*

   All formats presented in the two previous sections may be amended to
use 83 cylinders instead of 80. Just add the `cyl=83' to the format
description for superformat.  Using more cylinders has no effect on the
throughput.

     density     tot. cap.    throughput    media description
     5 1/4 HD    1494KB        27KB/s       hd sect=18 cyl=83
     3 1/2 HD    1743KB        26KB/s       hd sect=21 cyl=83
     3 1/2 ED    3486KB        52KB/s       ed sect=42 cyl=83

File: fdutils.info,  Node: Larger sectors,  Next: Mixed size sectors,  Prev: More cylinders,  Up: Extended formats

Larger sectors
==============

The floppy controller allows us to use larger sectors than the default
size of 512 bytes. All powers of two larger than 256 bytes are
acceptable sector sizes.  Large sectors have the same header and gap
sizes than smaller sectors, thus the overhead per byte of data is
smaller.  A little calculation shows this: A 1024 byte sector takes up
at least 1024+62+1 = 1087 raw bytes.  You can fit eleven sectors of this
size into a 12450 byte track.  This represents 11KB of data per track,
versus the 10.5KB only that can be achieved with 512 byte sectors.

   *Usage:* MS-DOS and other operating systems cannot normally read
these formats.  Lilo is not yet able to boot from this kind of disks.

   *Performance:* When any portion of one of these larger sectors is
read, the entire sector must be read.  When any portion of such a sector
is written to, the entire sector must be read, and then written back
with just the necessary portion modified.  Both of these circumstances
can entail worse performance than are listed in this table for small
reads and (especially) small writes.

   *Interesting Formats:*

     density     tot. cap.    throughput  media description
     5 1/4 HD    1440KB        30KB/s     dd sect=9 ssize=1KB
     3 1/2 HD    1760KB        55KB/s     hd sect=11 ssize=1KB
     3 1/2 ED    3520KB       110KB/s     ed sect=11 ssize=2KB

   The `ssize' parameter of the format description indicates the sector
size to be used.

File: fdutils.info,  Node: Mixed size sectors,  Next: Smart use of the dtr,  Prev: Larger sectors,  Up: Extended formats

Mixed sector size (MSS) formats
===============================

Using larger sectors has the disadvantage that the granularity is
larger.  For example, when using 4096 byte sectors, there is enough
space to fit two sectors in a track of 12450 bytes raw capacity, but not
three.  However, the two sector format leaves plenty of space available
(4132 bytes), in which smaller sectors would fit.  For example, these
4142 raw bytes can be put to good use by filling them with a 2 KB sector
(2048+62), plus an 1 KB sector (1024+62) and a 512 byte sector, leaving
still 362 bytes for gaps.

   Mixed sector size formats take advantage of this by using sectors of
several different sizes on a same track.  This way, a maximum capacity
of 12KB per track, distributed in one 8k sector and one 4k sector can be
achieved.

   *Usage:* There is no known MS-DOS utility which can read basic MSS
disks.  Lilo is not yet able to boot from this kind of disks.

   *Performance:* As any format with larger sectors, the performance
for small reads and writes is worse due to the larger granularity.

   *Interesting Formats:*

     density     tot. cap.    throughput    media description
     3 1/2 DD     880KB        28KB/s       hd tracksize=11b mss
     5 1/4 HD    1600KB        30KB/s       hd tracksize=10KB mss
     3 1/2 DD     880KB        28KB/s       hd tracksize=11b mss
     3 1/2 HD    1840KB        28KB/s       hd tracksize=23b mss
     3 1/2 HD    1920KB        30KB/s       hd tracksize=12KB mss
     3 1/2 ED    3680KB        56KB/s       ed tracksize=23KB mss
     3 1/2 ED    3840KB        60KB/s       ed tracksize=24KB mss

   For MSS formats, the system figures out the most efficient
repartition of sector sizes by itself.  You do not need to describe the
number of sectors and their size.  For MSS disks, the capacity of one
track is described directly, using the `tracksize' parameter.

   The `1920KB' and `3840KB' formats may be unreliable on some
computers.

File: fdutils.info,  Node: Smart use of the dtr,  Next: 2M,  Prev: Mixed size sectors,  Up: Extended formats

Smart use of the data transfer rate
===================================

Due to different drive rotations speeds, 5 1/4 double density disks and
3 1/2 double density disks are accessed using different raw data
transfer rates (300 kb/s for the faster spinning 5 1/4 disks, and only
250 kb/s for the slower spinning 3 1/2 disks).  The method described in
this section consists in using the faster data transfer rate intended
for 5 1/4 disks on 3 1/2 disks, and thus boost the raw capacity per
track of these disks.  This is possible because 300 kb/s is still low
enough not to excede the specification of the disk surface of a double
density disk (which 500 kb/s would).

   *Usage: this method is only available for 3 1/2 double density
disks.  The disk obtained cannot be booted from by LILO, and are
inaccessible from MS-DOS.*

   The following table shows the media description for a format using
this method in conjuncion with the previous methods:
     density     tot. cap.    throughput    media description
     3 1/2 DD     1120KB         17KB/s     qd tracksize=7KB mss

   We use the `QD' density selector to describe this particular DTR
set-up, although the acronym `QD' is already taken to name 96tpi double
density 5 1/4 disks.  However, as this dtr trickery is only meaningful
for 3 1/2, we hope that there will be no ambiguity.

File: fdutils.info,  Node: 2M,  Next: XDF,  Prev: Smart use of the dtr,  Up: Extended formats

2M formats
==========

2M formats use a standard geometry (18 normal sized sectors) on the
first side of the first cylinder, and an MSS geometry on the rest of the
disk.  They are inspired for Ciriaco Garcia de Celis' 2M utility for
MS-DOS.

   The advantage of 2M disks over simple MSS disks is twofold:
   * They can be accessed from DOS

   * They do not need an autodetect entry, as the boot sector is
     readable using a standard geometry.  Mtools can then use the
     information contained in the boot sector to configure the floppy
     driver to read the rest of the disk.

   Although 2m disk have less sectors on the first track than on the
others, the Linux floppy driver, and 2M's low level floppy access
routines pretend that it contains the same number of sectors.  The
missing sectors are called phantom sectors.  Writes to these sectors are
ignored, and reads return random data.  In order to make up for this, 2M
and mtools pretend that there is a duplicate FAT in the missing sectors,
which is simulated by using data from the first (real) FAT.  Thus 2M
disks work fine for their intended purpose, which is to hold an MS-DOS
filesystem.  *Never use 2M disks for anything other than a MS-DOS
filesystem.  For example, never make an ext2 filesystem on a 2M disk.
If you need a high capacity ext2 filesystem (or minix fs, raw tar or
cpio archive), use the corresponding MSS format instead*

   *Usage:* 2M disks are not bootable by LILO. They can be accessed in
MS-DOS using the 2M utility. 2M can be found at
ftp://FTP.Coast.NET/SimTel/msdos/diskutil/2m30.zip or at any other
simtel mirror. *2M disks are not suitable for non MS-DOS filesystems*.

   *Performance:* Just as with MSS disks, performance is bad for small
reads and writes.

   To describe a 2M format, add the keyword `2m' to its media
description:
     density     tot. cap.    throughput    media description
     3 1/2 HD    1840KB        28KB/s       hd tracksize=23b mss 2m

File: fdutils.info,  Node: XDF,  Next: XXDF,  Prev: 2M,  Up: Extended formats

XDF formats
===========

XDF is the format used for OS/2 installation floppies.

   Just like 2M, XDF uses mixed sector sizes on "generic tracks".  The
first cylinder uses 512 byte sectors.

   However, for XDF disks, the logical order of the sectors on a given
track, and their physical order is not the same.  This allows a faster
access, in a similar way that interleaving does for disk with normal
sized sectors and too small gaps.  XDF's sector arrangement allows it to
read sectors alternatively from both sides, i.e. the first sector from
side 0, the second from side 1, and the third from side 0 again.  This
differs from the usualy formats, where first the entire side 0 is read,
and then the entire side 1.  This technique allows to read both sides of
a disk in roughly three rotations.

   The following example illustrates how this is done.  In our example
we use the XDF format used for 3 1/2 HD disks, which contains one 8KB
sector, one 2KB sector, one 1KB sector, and one 512 byte sector per
track.  The upper line represents the sectors on side 0, and the lower
line represents the sectors on side 1.  Different numbers represent
different sectors.  Repeated identical numbers represent a single larger
sector.  As the disk is circular, some sectors wrap around at the end:
we find parts of the 8KB sector, represented by 6, both at the beginning
and at the end of each track.

     position:|          1         2         5         4
              | 1234567890123456789012345678901234567890
              |==========================================
     side 0:  | 6633332244444446666666666666666666666666
     side 1:  | 6666444444422333366666666666666666666666

     2   512 byte sector
     3   1KB sector
     4   2KB sector
     6   8KB sector

   When reading a track, sectors are read in the following order:
     sector id    head    position at start     position at end
     ----------------------------------------------------------
         3          0               3                 7
         4          0               9                16
         6          1              18                 5    (1st wrap around)
         2          0               7                 9
         2          1              12                14
         6          0              16                 3    (2nd wrap around)
         4          1               5                12
         3          1              14                18

   We notice that the start of each sector happens at least 2 units of
position (around 300 bytes), after the end of the previously read
sector, thus allowing the floppy disk controller sufficient time to
rest.  Moreover, we notice two wrap-arounds, yielding three rotations to
read the whole cylinder (the third rotation is due to the fact that we
stop at a higher position than we started, and that we also need to
allow some time for seeking to the next track).

   MSS or 2M formats of the same capacity nead at least 2 rotations per
side (i.e. 4 per track), yielding a lower throughput.

   *Usage:* XDF disks are not bootable by LILO.  They can be accessed
from MS-DOS and OS/2 using `xdfcopy.exe' or `xdf.com'.  They are only
suitable for MS-DOS filesystems.  The floppy driver has no direct
support for this format yet, but `mtools' is able to read them using
the `FDRAWCMD' ioctl.

   *Interesting Formats:*

     density     tot. cap.    throughput    formatting command
     5 1/4 HD    1600KB        46KB/s       xdfcopy -0 /dev/fd0
     3 1/2 HD    1840KB        38KB/s       xdfcopy -1 /dev/fd0
     3 1/2 ED    3840KB       102KB/s       xdfcopy -2 /dev/fd0

   The options `-1', `-2' and `-3' descibre one out of the five formats
understoood by `xdfcopy' (3 XDF formats and 2 XDF formats).

File: fdutils.info,  Node: XXDF,  Prev: XDF,  Up: Extended formats

XXDF formats
============

These use the simple principle as XDF, but use a higher geometry.  No
new principle is used, these formats are simply more daring (smaller
gaps, and smaller margin at the end of the sector).

   *Usage:* XXDF disks are not bootable by LILO, and can't be accessed
by MS-DOS.  They are only suitable for MS-DOS filesystems.  The floppy
driver has no direct support for this format yet, but `mtools' is able
to read them using the `FDRAWCMD' ioctl.  Due to their smaller
tolerances, XXDF formats may not work on all drives. Problems may also
occur if you write to XXDF disks using a different drive than the one
you used to format the disk.

   *Interesting Formats:*

     density     tot. cap.    throughput    formatting command
     3 1/2 HD    1920KB        45KB/s       xdfcopy -3 /dev/fd0
     3 1/2 ED    3840KB        90KB/s       xdfcopy -4 /dev/fd0

File: fdutils.info,  Node: Autodetection,  Next: Boottime configuration,  Prev: Extended formats,  Up: Top

How autodetection works
***********************

The principle of autodetection is rather simple. When a floppy disk is
first accessed, and its geometry is not yet known, the floppy driver
tries out a list of up to 8 geometries (format descriptions) until one
is found that matches (i.e. that makes it possible to read the first
sector or track).  This list of geometries is called the _autodetection
list_.  There is one autodetection list per drive type (as indicated in
the cmos).

   The autodetection list doesn't contain the geometry descriptions
themselves, but rather references to entries in the _geometry list_
(*note geometry list::).  Each list may contain up to 8 such references.
Each reference can be tagged with a `t' flag.  If this tag is set, the
floppy driver tries to read the whole track when trying out that
description; if it is not set, it only tries to read the boot sector.

   Reading the whole track is useful to distinguish among geometries
which differ only in the amount of sectors per track.  In order to do
this, put the geometry with the most sectors first in the list, and set
its `t' tag.  Use the `t' tag only in this case, as it makes
autodetection slower.

   Autodetection cannot distinguish between geometries that only differ
in the number of heads or in the number of tracks.

   Autodetection is meant to supply only a first approximation of the
actual format of the disk.  It supplies enough information to enable a
program such as `mtools' to read the boot sector, which contains the
exact information.  `Mtools' then uses the information contained in the
boot sector to set the exact geometry.

   The autodetection list is set using the following command:
     floppycontrol --autodetect LIST

Example
=======

The following example restores the default autodetection sequence for a
3 1/2 ED drive:

     floppycontrol --autodetect 7,8,4,25,28,22,31,21

   The following example changes this sequence, so as to add the 1680KB
format (number 11).  As only 8 formats are allowed in the autodetection
list, we have to dump one entry (we chose the last, which is numbered
21).  The 1680KB format is identical with the default 1440KB format
except for the number of sectors.  Thus we must read the whole track in
order to distinguish it from the 18 sector format (`t' flag).
Furthermore, the the 1680KB sector format should be detected first, as
an 21 sector disk would also matches the standard format with its 18
sectors.

     floppycontrol --autodetect 11t,7,8,4,25,28,22,31

   The following example attempts to autodetect CBM 1581 disks along
with the more usual formats.  CBM 1581 disks are not among the
predefined formats.  Thus we first have to pick one of the predefined
formats and change it so it fits our needs.  We may for example pick
one of the rarely used 5 1/4 formats, such as h880, which bears number
20).  We first make a device node bearing the requested number (so that
we have a filename to pass to setfdprm), then we chmod it so it becomes
accessible to mortal users, finally we configure the geometry of the
new node, and enter it into the autodetection list.  We place it at the
4th position, just behind the usual ED, HD and DD formats, and before
the more exotic extended formats.  Indeed, formats which are nearer to
the head of the list are autodetected faster, and hence more commonly
used formats should be put nearer to the beginning (1).

     mknod /dev/fd0cbm1581 b 2 80
     chmod 666 /dev/fd0cbm1581
     setfdprm /dev/fd0cbm1581 DD DS sect=10 cyl=80 ssize=512 fmt_gap=35 gap=12 swapsides
     floppycontrol --autodetect 7,8,4,20,25,28,22,31

   Some formats use more than 80 tracks. It is not possible for the
kernel to autodetect the number of tracks in a reasonable time, so you
have to use a sufficiently recent version of mtools to set the number
of tracks according to the boot sector of the disk. Mtools 3.0 and up
are ok. This doesn't obviously work with disks containing something
else than a MS-DOS filesystem.

   ---------- Footnotes ----------

   (1) except of course if several formats only differ in the number of
sectors per track, in which case the formats with the most sectors
should come first

File: fdutils.info,  Node: Boottime configuration,  Next: Floppy ioctls,  Prev: Autodetection,  Up: Top

Configuring the floppy driver via lilo or insmod
************************************************

The floppy driver is configured using the `floppy=' options in lilo.
These options can be typed at the boot prompt, or entered in the lilo
configuration file.

   Example: If your kernel is called `linux-2.0', type the following
line at the lilo boot prompt (if you have a thinkpad):
     linux-2.0 floppy=thinkpad
   You may also enter the following line in `/etc/lilo.conf', in the
description of `linux-2.0':
     append = "floppy=thinkpad"

   Several floppy related options may be given, example:
     linux-2.0 floppy=daring floppy=two_fdc
     append = "floppy=daring floppy=two_fdc"

   If you give options both in the lilo config file and on the boot
prompt, the option strings of both places are concatenated, the boot
prompt options coming last. That's why there are also options to
restore the default behaviour.

   If you use the floppy driver as a module, use the following syntax:
`insmod floppy 'floppy="OPTIONS"''. (This line may be unreadable in the
info version of this document. If so, please refer to the printed
version).

   Example:
     insmod floppy 'floppy="daring two_fdc"'

   Note that in this case `floppy=' should only be typed out once, and
not once for each option. You need at least modules-1.3.57 for this
method.  However, the older environment variable based syntax is still
available:
Bourne (sh, bash, ksh, zsh) syntax:
     `floppy="daring two_fdc" insmod floppy'

C-shell (csh, tcsh) syntax:
     `setenv floppy "daring two_fdc" ; insmod floppy'

   Some versions of insmod are buggy in one way or another. If you have
any problems (options not being passed correctly, segfaults during
insmod), first check whether there is a more recent version. If there
isn't, use the old method using environment variables.  Problems with
`insmod' happen mostly for options involving both a number and a
string, such as `floppy=0,4,cmos'.  Options only involving strings,
such as `floppy=daring' are not affected.

   The floppy related options include:

`floppy=daring'
     Tells the floppy driver that you have a well behaved floppy
     controller.  This allows more efficient and smoother operation,
     but may fail on certain controllers.

`floppy=0,daring'
     Tells the floppy driver that your floppy controller should be used
     with caution.

`floppy=one_fdc'
     Tells the floppy driver that you have only floppy controller
     (default)

`floppy=two_fdc'

`floppy=ADDRESS,two_fdc'
     Tells the floppy driver that you have two floppy controllers. The
     second floppy controller is assumed to be at ADDRESS. If ADDRESS is
     not given, 0x370 is assumed. two_fdc is implied if you use the cmos
     option with a drive of id 4 to 7.

`floppy=thinkpad'
     Tells the floppy driver that you have a Thinkpad. Thinkpads use an
     inverted convention for the disk change line.

`floppy=0,thinkpad'
     Tells the floppy driver that you don't have a Thinkpad.

`floppy=omnibook'
`floppy=nodma'
     Tells the floppy driver not to use Dma for data transfers.  This is
     needed for instance on some HP Omnibooks, which don't have a
     workable DMA channel for the floppy driver. This option is also
     useful if you frequently get "Unable to allocate DMA memory"
     messages.  Indeed, dma memory needs to be continuous in physical
     memory, and is thus harder to find, whereas non-dma buffers may be
     allocated in virtual memory.  However, I advise against this if
     you have an FDC without a FIFO (8272A or 82072). 82072A and later
     are OK. You also need at least a 486 to use nodma.  If you use
     nodma mode, I suggest you also set the FIFO threshold to 10 or
     lower, in order to limit the number of data transfer interrupts.

`floppy=dma'
     Tells the floppy driver that a workable DMA channel is available
     (the default).

`floppy=nofifo'
     Disables the FIFO entirely. This is needed if you get "Bus master
     arbitration error" messages from your ethernet card (or from other
     devices) while accessing the floppy.

`floppy=fifo'
     Enables the FIFO (default)

`floppy=THRESHOLD,fifo_depth'
     Sets the FIFO threshold. This is mostly relevant in DMA mode. If
     this is higher, the floppy driver tolerates more interrupt
     latency, but it triggers more interrupts (i.e. it imposes more
     load on the rest of the system). If this is lower, the interrupt
     latency should be lower too (faster processor). The benefit of a
     lower threshold is less interrupts.

     To tune the fifo threshold, switch on over/underrun messages using
     `floppycontrol --messages'. Then access a floppy disk. If you get a
     huge amount of `Over/Underrun - retrying' messages, then the fifo
     threshold is too low. Try with a higher value, until you only get
     an occasional Over/Underrun.  It is a good idea to compile the
     floppy driver as a module when doing this tuning. Indeed, it
     allows to try different fifo values without rebooting the machine
     for each test. Note that you need to do `floppycontrol --messages'
     every time you re-insert the module.

     Usually, tuning the fifo threshold should not be needed, as the
     default (0xa) is reasonable.

`floppy=DRIVE,TYPE,cmos'
     Sets the cmos type of DRIVE to TYPE. Additionnaly, this drive is
     allowed in the bitmask. This is useful if you have more than two
     floppy drives (only two can be described in the physical cmos), or
     if your BIOS uses non-standard CMOS types. The CMOS types are:
    `0'
          unknown or not installed

    `1'
          5 1/4 DD

    `2'
          5 1/4 HD

    `3'
          3 1/2 DD

    `4'
          3 1/2 HD

    `5'
          3 1/2 ED

    `6'
          3 1/2 ED

     Note that there are two valid types for ED drives. This is because
     5 was initially chosen to represent floppy tapes, and 6 for ED
     drives.  AMI ignored this, and used 5 for ED drives. That's why
     the floppy driver handles both) Setting the CMOS to 0 for the
     first two drives (default) makes the floppy driver read the
     physical cmos for those drives.

`floppy=unexpected_interrupts'
     Print a warning message when an unexpected interrupt is received
     (default behaviour)

`floppy=no_unexpected_interrupts'
`floppy=L40SX'
     Don't print a message when an unexpected interrupt is received.
     This is needed on IBM L40SX laptops in certain video modes. (There
     seems to be an interaction between video and floppy. The
     unexpected interrupts only affect performance, and can safely be
     ignored.)

`floppy=broken_dcl'
     Don't use the disk change line, but assume that the disk was
     changed whenever the device node is reopened. Needed on some boxes
     where the disk change line is broken or unsupported.  This should
     be regarded as a stopgap measure, indeed it makes floppy operation
     less efficient due to unneeded cache flushings, and slightly more
     unreliable. Please verify your cable, connection and jumper
     settings if you have any DCL problems.  However, some older
     drives, and also some Laptops are known not to have a DCL.

`floppy=debug'
     Print debugging messages

`floppy=messages'
     Print informational messages for some operations (disk change
     notifications, warnings about over and underruns, and about
     autodetection)

`floppy=silent_dcl_clear'
     Uses a less noisy way to clear the disk change line (which doesn't
     involve seeks). Implied by daring.

     (There are other options as well, but they are considered
     obsolete, and thus they are not documented here)


File: fdutils.info,  Node: Floppy ioctls,  Next: Commands,  Prev: Boottime configuration,  Up: Top

Floppy ioctls
*************

All these ioctl's may be issued using the floppycontrol program. (See
also floppycontrols man page)

`FDSETPRM'
     sets the geometry (number of tracks, heads and sectors, etc) of a
     drive.

`FDDEFPRM'
     sets the geometry in a permanent way (not cleared after a disk
     change)

`FDGETPRM'
     read a previously set drive geometry (or an autodetected geometry)
     back.

`FDCLRPRM'
     makes the driver forget the geometry for a given drive (to trigger
     autodetection)

`FDFLUSH'
     forgets the contents of the floppy buffers. CAUTION: This doesn't
     write dirty buffers to the disk. Use fsync first.

`FDGETDRVTYP'
     displays the type of a drive (name parameter). This is used by
     `MAKEFLOPPIES'. For the naming convention, see the description of
     the `MAKEFLOPPIES' script. For formats which work in several drive
     types, `FDGETDRVTYP' return a name which is appropriate for the
     oldes drive type which supports this format.

`FDSETDRVPRM'
     sets various drive parameters.

`FDGETDRVPRM'
     reads these parameters back.

`FDGETDRVSTAT'
     gets the cached drive state (disk changed, write protected et al.)

`FDPOLLDRVSTAT'
     polls the drive and return its state.

`FDGETFDCSTAT'
     gets the floppy controller state.

`FDRESET'
     resets the floppy controller under certain conditions.

`FDRAWCMD'
     sends a raw command to the floppy controller.

`FDWERRORCLR'
     clear the write error stats.

`FDWERRORGET'
     gets the write error stats.

`FDSETMAXERRS'
     sets the error thresholds (when to display error messages on the
     console, and when to abort operations). The maxerror structure is
     part of the drive parameters, but this ioctl is needed in addition
     to `FDSETDRVPRM' because `FDSETDRVPRM' is only accessible to the
     superuser whereas `FDSETMAXERRS' is accessible to whoever has
     write access to the floppy device.

`FDMSGON/FDMSGOFF'
     switch informational messages on/off. This flag is part of the
     drive parameters as well, but `FDMSGON/FDMSGOFF' don't need
     superuser status.


   There are other ioctls as well, but they are considered obsolete and
their use is discouraged.

File: fdutils.info,  Node: Commands,  Next: Compile-time configuration,  Prev: Floppy ioctls,  Up: Top

Command list
************

This section describes the available fdutils commands, and the command
line parameters that each of them accepts.

* Menu:

* diskd::             detect a disk change and execute a command
* diskseekd::         seeks the drive from time to time to shake of the
                      dust
* fdmount::           automatically mounts and unmounts floppy disks
* fdrawcmd::          send raw commands to the floppy disk controller
* floppycontrol::     configure the floppy driver
* floppymeter::       measures characteristic parameters of a floppy drive
* getfdprm::          print current geometry parameters
* makefloppies::      makes the floppy device entries
* superformat::       formats high capacity disks
* setfdprm::          changes the current and permanent geometry
                      parameters
* xdfcopy::           copies and formats XDF disks

File: fdutils.info,  Node: diskd,  Next: diskseekd,  Prev: Commands,  Up: Commands

diskd
=====

The diskd command has the following syntax:

     `diskd' [`-d' DRIVE] [`-i' INTERVAL] [`-e' COMMAND]

   Diskd waits for a disk to be inserted into a given DRIVE, and then
either executes the COMMAND or exits. This program can be used to
automatically mount a disk as soon as it is inserted.

Warning
-------

This program works by switching the motor on for a very short interval,
and then seeking to track -1. This might damage hardware in the long
run. Amigas, which also use these techniques, are known for having
problems with their disk drives no longer spinning up properly after a
few month of usage.

Options
-------

`-d DRIVE'
     Selects the drive to observe for disk insertion. By default, drive
     0 (`/dev/fd0') is observed.

`-i INTERVAL'
     Selects the polling interval. The interval is given in tenths of
     seconds. Default is 10 (one second).

`-e COMMAND'
     Gives the command to be executed when a disk is inserted. If no
     command is given the program simply exits. Typically, the command
     mounts the disk. It can be a shell scripts which probes for several
     filesystems and disk geometries until it succeeds.

Bugs
----

   * Automatic unmounting cannot yet be handled. It is indeed not
     enough to scan for disk removal, because when the disk is removed,
     it is already too late: There might be some buffers needing
     flushing.  However, the `fdmountd' program allows automatic
     unmounting by using the `SYNC' mount options, which switches off
     write buffering (*note fdmount::).

   * The drive motor is running all the time, and on some computers, the
     drive led flickers at each time the drive is polled.

File: fdutils.info,  Node: diskseekd,  Next: fdmount,  Prev: diskd,  Up: Commands

diskseekd
=========

Several people have noticed that Linux has a bad tendency of killing
floppy drives. These failures remained completely mysterious, until
somebody noticed that they were due to huge layers of dust accumulating
in the floppy drives. This cannot happen under Messy Dos, because this
excuse for an operating system is so unstable that it crashes roughly
every 20 minutes (actually less if you are running Windows).  When
rebooting, the BIOS seeks the drive, and by doing this, it shakes the
dust out of the drive mechanism. `diskseekd' simulates this effect by
seeking the drive periodically.  If it is called as `diskseek', the
drive is seeked only once.

Options
-------

The syntax for `diskseekd' is as follows:
     `diskseekd' [`-d' DRIVE] [`-i' INTERVAL] [`-p' PIDFILE]

`-d DRIVE'
     Selects the drive to seek.  By default, drive 0 (`/dev/fd0') is
     seeked.

`-i INTERVAL'
     Selects the cleaning interval, in seconds.  If the interval is 0, a
     single seek is done. This is useful when calling diskseek from a
     crontab.  The default is 1000 seconds (about 16 minutes) for
     `diskseekd' and 0 for `diskseek'.

`-p PIDFILE'
     Stores the process id of the diskseekd daemon into PIDFILE instead
     of the default `/var/run/diskseekd.pid'.

Bugs
----

  1. Other aspects of Messy Dos' flakiness are not simulated.

  2. This section lacks a few smileys.

File: fdutils.info,  Node: fdmount,  Next: fdrawcmd,  Prev: diskseekd,  Up: Commands

fdmount
=======

     `fdmount' [`-l'] [`--list'] [`-d'] [`--daemon'] [`--detach']
     [`-i' INTERVAL] [`--interval' INTERVAL] [`-o' MOUNT-OPTIONS]
     [`-r'] [`-readonly'] [`-s'] [`--sync'] [`--nosync'] [`--nodev']
     [`--nosuid'] [`--noexec'] [`-f'] [`--force'] [`-h'] [`--help']
     [DRIVENAME] [MOUNTPOINT]

     `fdumount' [`-f'] [`--force'] [DRIVENAME]

     `fdlist'

     `fdmountd' [`-i' INTERVAL] [`--interval' INTERVAL] [`-r']
     [`-readonly'] [`-s'] [`--sync'] [`--nosync'] [`--nodev']
     [`--nosuid'] [`--noexec'] [`--help'] [DRIVENAME] [MOUNTPOINT]]

   The `fdmount' program mounts a floppy disk in the specified drive.
It tries to figure out the exact format and filesystem type of the disk
from data in the disk's boot sector or super block and the
auto-detected track layout.

   Currently, fdmount supports the filesystems `minix', `ext', `ext2',
`xia', and `msdos', and includes special support for disks formatted by
the `2M' utility for MS-DOS.

   It also checks whether the disk is write protected, in which case it
is mounted read-only.

   The symbolic DRIVENAME is (currently) one of `fd[0-7]',
corresponding to the special device files `/dev/fd[0-7]'. If DRIVENAME
is not specified, `fd0' is assumed.

   The disk is mounted on the directory MOUNTPOINT, if specified, or on
`/fd[0-7]'.  In either case, the mount point must be an existing,
writable directory.

   *Due to a bug in the floppy driver (?), the polling interval (-i
flag) must be longer than the spindown offset. Thus you need to do (for
example) floppycontrol -spindown 99 before starting fdmountd in daemon
mode*

Options
-------

`-l -LIST'
     List all known drives with their symbolic name, type, and mount
     status.

`-d -DAEMON'
     Run in daemon mode (see below).

`--detach'
     Runs daemon in background, and detaches it from its tty. Messages
     produced after the fork are logged to syslog.

`-p FILE'
`--pidfile FILE'
     Dumps the process id of the daemon to FILE. This makes killing the
     daemon easier: `kill -9 `cat FILE`'

`-i INTERVAL'
`--interval INTERVAL'
     Set the polling interval for daemon mode. The unit for INTERVAL is
     0.1 seconds, the default value is 10 (i.e. 1 second).

`-o OPTIONS'
`--options OPTIONS'
     Sets filesystem-specific options. So far, these are only available
     for DOS and Ext2 disks. The following DOS options are supported:
     `check', `conv', `dotsOK', `debug', `fat', `quiet', `blocksize'.
     The following Ext2 options are supported: `check', `errors',
     `grpid', `bsdgroups', `nogrpid', `sysvgroups', `bsddf', `minixdf',
     `resgid', `debug', `nocheck'.  When running as a daemon, options
     not applying to the disk that is inserted (because of its
     filesystem type) are not passed to mount.

`-r -READONLY'
     Mount the disk read-only. This is automatically assumed if the
     disk is write protected.

`-s -SYNC'
     Mount with the `SYNC' option.

`--nosync'
     Mounts without the `SYNC' option, even when running as daemon.

`--nodev'
     Mount with the `NODEV' option. Ignored for `msdos' filesystems,
     otherwise always set for non-root users.

`--nosuid'
     Mount with the `NOSUID' option. Ignored for `msdos' filesystems,
     otherwise always set for non-root users.

`--noexec'
     Mount with the `NOEXEC' option.

`-f -FORCE'
     Attempt a mount or unmount operation even `/etc/mtab' says that
     the drive is already mounted, or not mounted, respectively.  This
     option is useful if `/etc/mtab' got out of sync with the actual
     state for some reason.

`-h -HELP'
     Show short parameter description


Security
--------

When mounting on the default mount point, the mount points' owner is set
to the current user, and the access flags according to the user's umask.
For a specified mountpoint, owner and permissions are left unchanged.
Default mount points are called `/fd0', `/fd1', ... , `/fd7'.

   The user running fdmount must have read access to the floppy device
for read only mounts, and read/write access for read/write mounts.

   Fdmount can be run suid root, allowing users to mount floppy disks.
The following restrictions are placed upon non-root users:

   * If a mountpoint is specified explicitly, it must be owned by the
     user.

   * A user may only unmount a disk if the mount point is owned by the
     user, or if it the disk has been mounted by the same user.

   * Non-msdos disks are automatically mounted with the `nodev' and
     `nosuid' flags set.

   However, *do not rely on fdmount being secure at the moment*.

Daemon mode
-----------

In daemon mode, the specified drive is periodically checked and if a
disk is inserted, it is automatically mounted.

   When the disk is removed, it is automatically unmounted.  However,
it is recommended to unmount the disk manually _before_ removing it. In
order to limit corruption, disks are mounted with the SYNC option when
running in daemon mode, unless the `--nosync' flag is given.

   Note that this mode has some potential drawbacks:
   * Some floppy drives have to move the drive head physically in order
     to reset the disk change signal. It is strongly recommended not to
     use daemon mode with these drives.  *Note floppycontrol::, for
     details.

   * If a disk does not contain a filesystem (e.g. a tar archive), the
     mount attempt may slow down initial access.

   * As fdmount cannot identify the user trying to use the disk drive,
     there is no way to protect privacy. Disks are always mounted with
     public access permissions set.

Diagnostics
-----------

`error opening device NAME'

`error reading boot/super block'
     fdmount failed to read the first 1K of the disk. The disk might be
     damaged, unformatted, or it may have a format wich is unsupported
     by the FDC or the Linux kernel.

`unknown filesystem type'
     No magic number of any of the supported filesystems (see above)
     could be identified.

`sorry, can't figure out format (FS filesystem)'
     The size of the filesystem on the disk is incompatible with the
     track layout detected by the kernel and an integer number of
     tracks. This may occur if the filesystem uses only part of the
     disk, or the track layout was detected incorrectly by the kernel.

`failed to mount FS> <SIZEK-disk'
     The actual `mount' system call failed.

`failed to unmount'
     The actual `unmount' system call failed.

`cannot create lock file /etc/mtab~'
     If `/etc/mtab~' exists, you should probably delete it. Otherwise,
     check permissions.

`Can't access MOUNTPOINT'
     Most probably, the default or specified mount point does not exist.
     Use mkdir.

`MOUNTPOINT is not a directory'
     The mountpoint is not a directory.

`not owner of MOUNTPOINT'
     Non-root users must own the directory specified as mount point.
     (This does not apply for the default mount points, /fd[0-3].)

`No write permission to MOUNTPOINT'
     Non-root users must have write permission on the mount point
     directory.

`Not owner of mounted directory: UID=UID'
     Non-root users cannot unmount if the mount point is owned (i.e.
     the disk was mounted) by another user.

`invalid drive name'
     Valid drive names are `fd0', `fd1', etc.

`drive NAME does not exist'
     The drive does not exist physically, is unknown to the Linux
     kernel, or is an unknown type.

`Drive NAME is mounted already'
     Trying to mount a drive which appears to be mounted already.  Use
     the `--force' option if you think this is wrong.

`Drive NAME is not mounted'
     Trying to unmount a drive which does not appear to be mounted.
     Use the `--force' option if you think this is wrong.

`ioctl(...) failed'
     If this occurs with the `FDGETDRVTYP' or `FDGETDRVSTAT', ioctl's
     you should probably update your Linux kernel.

`mounted FS SIZE-disk (OPTIONS)'
     Success message.


Bugs
----

   * Fdmount should be more flexible about drive names and default
     mount points (currently hard coded).

   * Probably not very secure yet (when running suid root).  Untested
     with ext and xia filesystems.

   * Can't specify filesystem type and disk layout explicitly.

   * In daemon mode, the drive light stays on all the time.

   * Some newer filesystem types, such as vfat are not yet supported.


File: fdutils.info,  Node: fdrawcmd,  Next: floppycontrol,  Prev: fdmount,  Up: Commands

fdrawcmd
========

     `fdrawcmd' [`drive='DRIVE] [`rate='RATE]
     [`length='LENGTH] [`repeat='REPEAT]
     [`cylinder='PHYSICAL-CYL] COMMAND [PARAMTERS ...] [MODE]

   `fdrawcmd' is used to send raw commands to the floppy disk
controller, after having selected a given drive. You must have write
permission to the selected drive.

   When writing to a disk, data is read from stdin; when reading, data
is printed to stdout.  Diagnostic messages, return values from the
controller, and the value of the disk change line after the command are
printed to stderr.

Options
-------

All numbers may be given in octal (0211), decimal (137), or hexadecimal
(0x89).

`drive=DRIVE'
     Selects the drive.  The default is drive 0 (`/dev/fd0').

`rate=RATE'
     Selects the data transfer rate. Use 0 for high density disks, 1 for
     double density 5 1/4 disks (or 2 Mbps tapes, if the appropriate
     rate table is selected), and 2 for double density 3 1/2 disks.

`length=LENGTH'
     Describes the length of the transferred data for commands reading
     from and writing to the disk.  The default is to continue until
     end of file.

`repeat=COUNT'
     Repeat the command COUNT times.  This only works correctly for
     commands which don't do any data transfer.

`cylinder=COUNT'
     Seek to the given cylinder before executing the command

`COMMAND'
     The name of the command to send.  COMMAND may be a spelled out
     name (like `read' or `write'), or a number representing the
     commands floppy disk controller opcode.  A named command has
     already a mode associated with it, whereas for a number the mode
     parameter should be described using the `mode' option.

`PARAMETERS'
     The parameters for the command (optional, not all commands need
     parameters).

`MODE'
     Various flags or'ed together describing the properties of the
     command.


Commands
--------

The description of the various floppy commands given in this manpage is
very sketchy. For more details get the 82078 spec sheet which can be
found at:
     http://www-techdoc.intel.com/docs/periph/fd_contr/datasheets/

   Look for the chapter `COMMAND SET/DESCRIPTIONS'.  Older FDCs only
support a subset of the commands described therein, but the syntax for
the commands that do exist is the same.

Commands available on all FDCs
..............................

`read DRVSEL CYL HEAD SECT SZCOD SPT RW-GAP SZCOD2'
     Reads LENGTH bytes of data from the disk.  DRVSEL is the drive
     selector. Bit 0 and 1 describe the drive, and bit 2 describes the
     head.  The remaining parameters give the cylinder, head (yes,
     again), sector, size of the sector (128 * 2 ^ SZCOD), sectors per
     track (`spt', this is used to switch to the second head when the
     first side has been read), and size of the read-write gap. SZCOD2
     should be 0xff.  `read' returns ST0 ST1 ST2 and CYL HEAD SECT
     SZCOD of the next sector to be read; see
     `/usr/include/linux/fdreg.h' .

     N.B. Certain newer floppy disk controllers are buggy, and do not
     correctly recognize the end of transfer when operating in virtual
     DMA mode.  For these, you need to set `spt' to the id of the last
     sector to be read (for example, if you intend to read sectors 2,
     3, 4, set `spt' to 4, even if the disk has more sectors), and set
     the `no-mt' flag.

`write DRVSEL CYL HEAD SECT SZCOD SPT RW-GAP SZCOD2'
     Analogous to `read'.

`sense DRVSEL'
     Returns the third status byte (ST3)

`recalibrate DRVSEL'
     Recalibrates the drive and returns ST0 ST1.

`seek DRVSEL CYL'
     Moves the head to CYL and returns ST0 ST1.

`specify DRVSEL SPEC1 SPEC2'
     Specify various parameters to the drive.

`format DRVSEL SZCOD SECT-PER-TRACK FMT-GAP FMT-FILL'
     Formats the cylinder. The new sectors are filled with FMT-FILL.
     The header information comes from the input, which is made up of
     CYL HEAD SECT SZCOD quadruples. The SZCOD parameter from the
     command line is used to describe the actual size of the sectors,
     and the SZCOD from the input is used to write into the header.
     However, the first write to these sectors will use the header
     information, and might overwrite the following sectors if the
     SZCOD parameter from the command line was too small.

`readid DRVSEL'
     reads the first sector header that comes and returns ST0 ST1 ST2
     and CYL HEAD SECT SZCOD  of the encountered header.

Commands available on 82072 and later
.....................................

`dumpregs'
     Prints the contents of the FDCs registers, if supported.

Commands available on 82072A and later
......................................

`configure CONF1 CONF2 CONF3'
     Configures FIFO operation.

Commands available on 82077 and later
.....................................

`version'
     Echoes 0x90 if the FDC is more recent than 82072A, and 0x80
     otherwise

`perpendicular RATE'
     Sets the perpendicular mode.  Use 0 for normal, 2 for 500kb/s
     perpendicular, and 3 for 1 Mb/s perpendicular.

`seek-out DRVSEL N'
     does a relative seek of N cylinders towards cylinder 0.

`seek-in  DRVSEL N'
     does a relative seek of N cylinders away from cylinder 0.

Commands available on 82077AA and later
.......................................

`lock'
     Locks the FIFO configuration, so that it survives a FDC software
     reset.

`unlock'
     Unlock the FIFO configuration

Commands available on 82078
...........................

`partid'
     echoes a byte describing the type of the FDC in the 3 high bits,
     and the stepping in the three low bits.

`powerdown POWERCONF'
     configures automatic power down of the FDC. The old configuration
     is echoed

`option ISO'
     enables/disables ISO formats. Odd values of ISO enable these
     formats, whereas even values disable them. ISO formats don't have
     index headers, and thus allow to fit slightly more data on a disk.

`save'
     prints out 16 internal registers of the FDC.

`restore R1 R2 R3 ... R16'
     restores the 16 internal registers of the FDC.

`format_n_write DRVSEL SZCOD SECT-PER-TRACK FMT-GAP FMT-FILL'
     formats the cylinder and writes initial data to it. The input data
     is made up of a sequence of headers (4 bytes) and data: HEADER1
     DATA1 HEADER2 DATA2 ... HEADERN DATAN

`drivespec DSPEC1 DSPEC2 ... SPECN TERMINATOR'
     chooses rate tables for various drives. Each dspec byte describes
     one drive. Bits 0 and 1 say which drive is described. Bits 2 and 3
     describe the rate table. Only tables 0 and 2 are interesting. Both
     tables only differ in the meaning og rate 1. For table 0 (the
     default) rate 0 is 300 kb/s (used for 5 1/4 DD disks), whereas for
     table 1 it is 2 Mbps (used for fast floppy tape drives). Bit 4 is
     the precompensation table select bit. It should be set to 0. Bit
     5-7 should be zero as well. The TERMINATOR byte ends the
     `drivespec' command. It is either 0xc0 or 0x80. If it is 0xc0, no
     result phase follows; if it is 0x80, the current data rate table
     configuration for the four drives is echoed.

Modes
-----

The mode option is only needed when you describe the command as a
numerical value. Some mode names are also valid command names. They are
considered as command name if the command name has not yet been given,
and as mode name otherwise.

   If you give a command name followed by explicit modes, both the
implicit flags of the command name, and the explicit modes are or'ed
together.

   If on the other hand you give a command name preceded by explicit
modes, only the explicit modes are or'ed together.

`read'
     Read data from disk using DMA.

`write'
     Write data to the disk.

`intr'
     Wait for an interrupt.

`spin'
     wait for the disk to spin up

`disk'
     Aborts the operation if no disk is in the drive. This only works
     if you also chose a physical cylinder to seek to.

`no-motor'
     Don't switch on the drive motor while issuing the command

`no-motor-after'
     Switch off the motor immediately after the command returns.

`fm'
     Uses the FM version of the `read', `readid', `write' and `format'
     commands.

`no-mt'
     Do not use MT (multitrack) mode for the `read', `readid' and
     `write' commands. This is needed on certain broken FDC's which
     don't recognize end of transfer when running in `nodma' mode. In
     order to use these safely, set `no-mt', and chose the id of the
     last sector to be read as `sect-per-track'.


   `fdrawcmd' opens the device node with the `NDELAY' flag. This means
that the driver should not try to autodetect the disk type (it might
not be formatted), and that it should not reset the FDC. If a reset was
needed, the command simply fails. If that happens, execute
`floppycontrol --resetnow 0' , and try again.

File: fdutils.info,  Node: floppycontrol,  Next: floppymeter,  Prev: fdrawcmd,  Up: Commands

floppycontrol
=============

     `floppycontrol' [`-p'] [`--pollstate'] [`--printfdstate']
     [`-a' OPERATION-ABORT-THRESHOLD] [`-c' READ-TRACK-THRESHOLD]
     [`-r' RECALIBRATE-THRESHOLD] [`-R' RESET-THRESHOLD]
     [`-e' REPORTING-THRESHOLD] [`-f'] [`-x'] [`-d' DRIVE][`-F'] [`-T']
     [`-reset' CONDITION] [`--debug'] [`--nodebug'] [`--messages']
     [`--nomessages'] [`--broken_dcl'] [`--working_dcl'] [`--inverted_dcl']
     [`--no_inverted_dcl'] [`--silent_dcl_clear'] [`--noisy_dcl_clear']
     [`-c'CMOS-TYPE] [`-hlt' HLT] [`-hut' HUT] [`-srt' SRT] [`-o' SPINDOWN]
     [`-u' SPINUP] [`-s' SELECT-DELAY] [`-rps' ROTATIONS-PER-SECOND]
     [`-O' SPINDOWN-OFFSET] [`-track' MAX-TRACKS] [`-timeout' SECONDS]
     [`-C' CHECK-INTERVAL] [`-n' NATIVE-FORMAT]
     [`-autodetect' AUTODETECTION-SEQUENCE] [`-P'] [`--clrwerror']
     [`--printwerror'] [`-h']

   The `floppycontrol' program is used to configure the floppy driver.

* Menu:

* General options::          General purpose options
* One time actions::         Perform various actions
* Printing options::         Print out current configuration
* Drive type configuration:: Do you have a 3 1/2 double density drive or
                             a 5 1/4 high density drive?
* DCL configuration::        Disk change line configuration.
* Timing parameters::        Change the timings of various operations
* Debugging::                Switching debugging messages on/off
* Error handling options::   How should the floppy driver react when
                             encountering disk errors
* Write error reporting::    gather statistics about write errors
* Misc options::             Other configuration options

File: fdutils.info,  Node: General options,  Next: One time actions,  Prev: floppycontrol,  Up: floppycontrol

General Options
---------------

`-h'
`--help'
     Print a help screen.

`-d DRIVE'
`--drive  DRIVE'
     Selects the drive to configure. The default is drive 0
     (`/dev/fd0').


File: fdutils.info,  Node: One time actions,  Next: Printing options,  Prev: General options,  Up: floppycontrol

One time actions
----------------

The following `floppycontrol' options don't set a configuration
parameter, but perform a one-time action. They are available to anybody
who has write access to the drive

`-f'
`--flush'
     Flushes (throws away) the dirty data buffers associated with this
     drive.

`-x'
`--eject'
     Ejects the disk out of the drive (Sparc). The dirty buffers are
     first committed to disk before ejecting it. Fails if the disk is
     mounted.

`--reset  CONDITION'
     Resets the FDC under CONDITION . Condition may be one of the
     following:
    `0'
          resets the FDC only if a reset is needed anyways,

    `1'
          resets the FDC also if a raw command has been performed since
          the last reset, and

    `2'
          resets the FDC unconditionally.

     This command may be needed after some failed raw commands (*note
     fdrawcmd::).

`-F'
`--formatend'
     Issues an end format ioctl. This might be needed after exiting a
     `fdformat' in an unclean way. `superformat' is not subject to this.


File: fdutils.info,  Node: Printing options,  Next: Drive type configuration,  Prev: One time actions,  Up: floppycontrol

Printing current settings
-------------------------

`-T'
`--type'
     Print out the drive name of a floppy device. This is used by the
     `MAKEFLOPPIES' script. The drive name is a letter (describing the
     drive type) followed by the capacity of the format in bytes. The
     letter is E for 3.5 ED drives, H for 3.5 HD drives, D for 3.5 DD
     drives, h for 5.25 HD drives and d for 5.25 DD drives. The drive
     type letter corresponds to the oldest drive type supporting the
     format of this device node (not necessarily the type of the drive
     refered by this node.)  For the generic format nodes (/dev/fd0 et
     al.)  the name of "native format" of the drive is printed, and for
     the default formats, if a generic format has been redefined, its
     name becomes `(null)'.

`-p'
`--print'
     Prints out the configuration of the drive. The names of the various
     fields are the same as the names of the option to set them, see
     below.

`-P'
`--printstate'
     Prints out the cached internal state of the driver. The first line
     lists various attributes about the disk:
    `drive present'
    `disk present'
    `disk writable'
          These are only updated when the drive is accessed.

    `spinup'
          is the time when the motor became switched on for the last
          time.

    `select'
          is the time when the drive became selected for the last time

    `first_read'
          is the time when the first read request after the last spin up
          completed.

    `probed_fmt'
          is the the index of the autodetected format in the
          autodetection sequence for this drive.

    `cylinder'
          is the cylinder where the drive head currently sits.  If this
          number is negative, it has the following meaning:
             * -1 means that the driver doesn't know, but the
               controller does (a seek command must be issued).

             * -2 means that the controller doesn't know either, but is
               sure that it not beyond the 80th track.  The drive needs
               a recalibration.

             * -3 means that the head may be beyond the 80th track.
               The drive needs two successive recalibrations, because
               at each recalibration, the controller only issues 80
               move head commands per recalibration.

    `maxblock'
          is the highest block number that has been read.

    `maxcylinder'
          is a boolean which is set when a sector that is not on
          cylinder 0/head 0 has been read.  These are used for smart
          invalidation of the buffer cache on geometry change.  The
          buffer cache of the drive is only invalidated on geometry
          change when this change actually implies that a block that
          has already been read changes position. This optimization is
          useful for mtools which changes the geometry after reading
          the boot sector.

    `generation'
          is roughly the number of disk changes noticed since boot.
          Disk changes are noticed if the disk is actually changed, or
          if a flush command is issued and for both cases if any I/O
          to/from the disk occurs. (i.e. if you insert several disks,
          but don't do any I/O to them, the generation number stays the
          same.)

    `refs'
          is number of open file descriptors for this drive. It is
          always at least one, because floppycontrol's file descriptor
          is counted too.

    `device'
          is format type (as derived from the minor device number)
          which is currently being used.

    `last_checked'
          is date (in jiffies) when the drive was last checked for a
          disk change, and a disk was actually in the drive.

`--pollstate'
     Polls the drive and then prints out the internal state of the
     driver.(`--Printstate' only prints out the cached information
     without actually polling the drive for a disk change.)

`--printfdcstate'
     Prints out the state of the controller where the target drive is
     attached to.
    `spec1'
    `spec2'
          are the current values of those registers.

    `rate'
          is current data transfer rate

    `rawcmd'
          is true if a raw command has been executed since the last
          reset. If this is the case, a reset will be triggered when a
          drive on the same FDC is next opened.

    `dor'
          is the value of the digital output register. The 4 high bits
          are a bit mask describing which drives are spinning, the 2
          low bits describe the selected drive, bit 2 is used to reset
          the FDC, and bit 3 describes whether this FDC has hold of the
          interrupt and the DMA. If you have two FDCs, bit 3 is only
          set on one of them.

    `version'
          is the version of the FDC. See `linux/include/linux/fdreg.h'
          for a listing of the FDC version numbers.

    `reset'
          is true if a reset needs to be issued to the FDC before
          processing the next request.

    `need_configure'
          is true if this FDC needs configuration by the `FD_CONFIGURE'
          command.

    `has_fifo'
          is set if the FDC understands the `FD_CONFIGURE' command.

    `perp_mode'
          describes the perpendicular mode of this FDC. 0 is
          non-perpendicular mode, 2 is HD perpendicular mode, 3 is ED
          perpendicular mode, and 1 is unknown.

    `address'
          is the address of the first I/O port of the FDC.  Normally,
          this is 0x3f0 for the first FDC and 0x370 for the second.


File: fdutils.info,  Node: Drive type configuration,  Next: DCL configuration,  Prev: Printing options,  Up: floppycontrol

Drive type configuration and autodetection
------------------------------------------

The following options handle the different available drive types, such
as double density vs. high density vs. extra density drives, and 5 1/4
drives vs 3 1/2 drives.  Usually the drive type is stored in a
non-volatile memory, called CMOS, under the form of an integer ranging
from 1 to 6.

   Different drive types are able to handle and autodetect different
formats (different autodetection lists). They also have different
"native format name". The native format is the "usual" format with the
highest capacity supported by the drive. (For example 720KB on a double
density 3 1/2 drive, and 1.2MB on a high density 5 1/4 drive.)

   These settings are only changeable by the super user.

`-c CMOS-TYPE'
`--cmos  CMOS-TYPE'
     Set the virtual CMOS type of the floppy drive. This is useful if
        * the physical CMOS type is wrong (this may happen with BIOSes
          which use a non-standard mapping),

        * you have more than two drives (the physical CMOS may only
          describe up to two drives).

        * you have a BIOS that allows swapping drives A: and B: for DOS.

     Right now, this CMOS parameter is not used by the kernel, except
     for feeding it back to other applications (for instance
     `superformat', `floppymeter' or `MAKEFLOPPIES').  It is also
     possible to supply a virtual CMOS type with the `cmos' boot option
     (*note Boottime configuration::).  If possible, I recommend you
     use the boot option, rather than `floppycontrol', because the boot
     option also sets any parameters derived from the CMOS type, such
     as the autodetection list and the native format, whereas
     `floppycontrol' does not.

`-A  AUTODETECT-SEQ'
`--autodetect  AUTODETECT-SEQ'
     Set the autodetection sequence (*note Autodetection::) The
     autodetection sequence is a comma-separated list of at most eight
     format descriptors. Each format descriptor is a format number
     optionally followed by the letter `t'.  For drive 0, the format
     number is the minor device number divided by 4.  The autodetection
     sequence is used by the driver to find out the format of a newly
     inserted disk. The formats are tried one after the other, and the
     first matching format is retained. To test the format, the driver
     tries to read the first sector on the first track on the first
     head when `t' is not given, or the whole first track when `t' is
     given. Thus, autodetection cannot detect the number of tracks.
     However, this information is contained in the boot sector, which
     is now accessible. The boot sector can then be used by mtools to
     configure the correct number of tracks.

     Example:
          7,4,24t,25
     means to try out the formats whose minor device numbers are 28
     (1.44M), 16 (720KB), 96 (1.76MB), and 100 (1.92MB), in this order.
     For the 1.76MB format, try to read the whole track at once.

     Reading the whole track at once allows you to distinguish between
     two formats which differ only in the number of sectors. (The
     format with the most sectors must be tried first.)  If you use
     mtools(1), you do not need this feature, as mtools can figure out
     the number of sectors without any help from the floppy driver, by
     looking at the boot sector.

     Reading the whole track at once may also speed up the first read
     by 200 milliseconds. However, if, on the other hand, you try to
     read a disk which has less sectors than the format, you lose some
     time.

     I suggest that you put the most often used format in the first
     place (barring other constraints), as each format that is tried
     out takes 400 milliseconds.

`-n NATIVE-FORMAT'
`--native_format  NATIVE-FORMAT'
     Set the native format of this drive. The native format of a drive
     is the highest standard format available for this drive. (Example:
     For a 5 1/4 HD drive it is the usual 1200K format.) This is format
     is used to make up the format name for the generic device (which
     is the name of the native format). This drive name is read back
     from the kernel by the `MAKEFLOPPIES' script which uses it to
     decide which device nodes to create.


   ---------- Footnotes ----------

   (1) Version 3.0 or higher

File: fdutils.info,  Node: DCL configuration,  Next: Timing parameters,  Prev: Drive type configuration,  Up: floppycontrol

Configuration of the disk change line
-------------------------------------

`--broken_dcl'
     Assumes that the disk change line of the drive is broken.  If this
     is set, disk changes are assumed to happen whenever the device
     node is first opened. The physical disk change line is ignored.

     This option should be used if disk changes are either not detected
     at all, or if disk changes are detected when the disk was actually
     not changed.  If this option fixes the problem, I'd recommend that
     you try to trace the root cause of the problem.  Indeed, this
     options results in reduced performance due to spurious cache
     flushes.

     The following hardware problems may lead to a bad disk change line:
        * If the floppy cable is not inserted straight, or if it is
          kinked, the disk change line is likely to suffer, as it is on
          the edge of the cable.  Gently press on both connectors of
          the cable (drive and controller) to insure that all wires
          make contact.  Visually inspect the cable, and if it shows
          obvious traces of damage, get a new one.

        * On some drives, the locations disk change line may be chosen
          by jumper. Make sure that your floppy controller and your
          drive agree on which line is the disk change line.

        * Some older drives (mostly double density 5 1/4 drives) don't
          have a disk change line.  In this case, you have no choice
          other than to leave the `broken_dcl' option on.

`--working_dcl'
     Assumes that the disk change line works all right. Switching from
     broken to working may lead to unexpected results after the first
     disk change.

`--inverted_dcl'
     Assumes that this disk drive uses an inverted disk change line.
     Apparently this is the case for IBM thinkpads.

`--no_inverted_dcl'
     Assumes that this drive follows the standard convention for the
     disk change line.

`--noisy_dcl_clear'
     Switches off silent disk change line clearing for this drive.


File: fdutils.info,  Node: Timing parameters,  Next: Debugging,  Prev: DCL configuration,  Up: floppycontrol

Timing Parameters
-----------------

This section describes how to configure drive timings.  To set these
parameters, you need superuser privileges. All times are in "jiffy"
units (10 milliseconds), unless otherwise specified.

`--hlt  HLT'
     Set the head load time (in microseconds) for this floppy drive.
     The head load time describes how long the floppy controller waits
     after seeking or changing heads before allowing access to a track.

`--hut  HUT'
     Set the head unload time (in microseconds) for this floppy drive.
     The head unload time describes how long the floppy controller
     waits after an access before directing its attention to the other
     head, or before seeking.

`--srt  SRT'
     Set the step rate (in microseconds) for this floppy drive.  The
     step rate describes how long the drive head stays on one cylinder
     when seeking.  Setting this value to low (too fast seeks) may make
     seeks fail, because the motor doesn't follow fast enough.

`-u SPINUP-TIME'
`--spinup  SPINUP-TIME'
     Set the spinup time of the floppy drive. In order to do read or
     write to the floppy disk, it must spin. It takes a certain time
     for the motor to reach enough speed to read or write. This
     parameter describes this time. The floppy driver doesn't try to
     access the drive before the spinup time has elapsed. With modern
     controllers, you may set this time to zero, as the controller
     itself enforces the right delay.

`-o SPINDOWN-TIME'
`--spindown  SPINDOWN-TIME'
     Set the spindown time of this floppy drive. The motor is not
     stopped immediately after the operation completes, because there
     might be more operations following. The spindown time is the time
     the driver waits before switching off the motor.

`-O SPINDOWN-OFFSET'
`--spindown_offset  SPINDOWN-OFFSET'
     Set the spindown offset of this floppy drive. This parameter is
     used to set the position in which the disk stops. This is useful to
     minimize the next access time. (If the first sector is just near
     the head at the very moment at which the disk has reached enough
     speed, you win 200 milliseconds against the most unfavorable
     situation).

     This is done by clocking the time where the first I/O request
     completes, and using this time to calculate the current position of
     the disk.

`-s SELECT-DELAY'
`--select_delay  SELECT-DELAY'
     Set the SELECT DELAY of this floppy drive. This is the delay that
     the driver waits after selecting the drive and issuing the first
     command to it. For modern controllers/drives, you may set this to
     zero.

`-C CHECK-INTERVAL'
`--checkfreq  CHECK-INTERVAL'
     Set the maximal disk change check interval.  The disk change line
     is checked whenever a read or write to the device is issued, and
     it has not been checked for more than INTERVAL jiffies.

File: fdutils.info,  Node: Debugging,  Next: Error handling options,  Prev: Timing parameters,  Up: floppycontrol

Debugging messages
------------------

This subsection describes how to switch the available debugging messages
on and off.

`--debug'
     Switch debugging output on. The debugging information includes
     timing information. This option might be useful to fine-tune the
     timing options for your local setups. (But for most normal
     purposes, the default values are good enough.)

`--nodebug'
     Switch debugging output off.

`--messages'
     Print informational messages after autodetection, geometry
     parameter clearing and dma over/underruns.

`--nomessages'
     Don't print informational messages after these events.


File: fdutils.info,  Node: Error handling options,  Next: Write error reporting,  Prev: Debugging,  Up: floppycontrol

Error Handling Options
----------------------

The following options configure the behavior of the floppy driver in
case of read/write errors. They may be used by any user who has write
privileges for the drive. Whenever the floppy driver encounters an
error, a retry counter is incremented. If the value of this counter gets
bigger than the thresholds described below, the corresponding actions
are performed at the next retry. The counter is reset when the read or
write finally terminates, whether successfully or not.
`-a OPERATION-ABORT-TRSHLD'
`--abort  OPERATION-ABORT-TRSHLD'
     Tell the floppy driver to stop trying to read/write a sector after
     OPERATION-ABORT-TRSHLD retries, and signal the I/O error to the
     user.

`-t READ-TRACK-TRSHLD'
`--readtrack  READ-TRACK-TRSHLD'
     Tell the floppy driver to switch from track-reading mode to
     sector-at-a-time-mode after READ-TRACK-TRSHLD retries.

`-r RECALIBRATE-TRSHLD'
`--recalibrate  RECALIBRATE-TRSHLD'
     Tell the floppy driver to recalibrate the drive after
     RECALIBRATE-TRSHLD retries.

`-R RESET-TRESHOLD'
`--reset  RESET-THRESHOLD'
     Tell the floppy driver to reset the controller after
     RESET-THRESHOLD retries. After a controller reset, the floppy
     driver also recalibrates all drives connected to that controller.

`-e ERROR-REPORT-TRSHLD'
`--reporting  ERROR-REPORT-TRSHLD'
     Tell the floppy driver to start printing error messages to the
     console after ERROR-REPORT-TRSHLD retries.

File: fdutils.info,  Node: Write error reporting,  Next: Misc options,  Prev: Error handling options,  Up: floppycontrol

Write error reporting
---------------------

Due to the buffer cache, write errors cannot always be reported to the
writing user program as soon as the write system call returns.  Indeed,
the actual writing may take place much later. If a write error is
encountered, the floppy driver stores information about it in its per
drive write error structure.  This write error structure stays until
explicitly cleared.  It can for example be queried by a backup program
which wants to make sure that the data has been written successfully.

`--clrwerror'
     Clears the write error structure.

`--printwerror'
     Prints the contents of the write error structure:
    `write_errors'
          is a count of how many write errors have occurred since the
          structure was last cleared.

    `badness'
          is the maximal number of retries that were needed to complete
          an operation (reads, writes and formats).

    `first_error_sector'
          is where the first (chronologically) write error occurred.

    `first_error_generation'
          is the disk change generation in which did the first write
          error occurred.  The disk change generation is a number which
          is incremented at each disk change.

    `last_error_sector'
          and

    `last_error_generation'
          are similar.


File: fdutils.info,  Node: Misc options,  Prev: Write error reporting,  Up: floppycontrol

Other drive configuration options
---------------------------------

This subsection lists per drive configuration options, which don't fit
in any other category.  They are available only to the superuser:

`--tracks  MAX-TRACKS'
     Set the maximal numbers of physical tracks that this drive may
     handle. If you have a drive which is only able to handle 80 tracks
     (making strange noises when you try to format or read a disk with
     more than 80 tracks), use this option to prevent unprivileged
     users of damaging your drive by repeatedly reading disks with more
     than 80 tracks.

     If you trust your users and your disks, you don't need this. With
     most drives you don't need to worry anyways. *Note More
     cylinders::, for details.

`-i SECTOR-INTERLEAVE'
`--interleave SECTOR-INTERLEAVE'
     Set the number of sectors beyond which sector interleaving will be
     used.  This option will only be used by the `FDFMTTRK' ioctl.  The
     `fdformat' command, which is now considered obsolete, uses
     `FDFMTTRK' ioctl, but `superformat' does not.


File: fdutils.info,  Node: floppymeter,  Next: getfdprm,  Prev: floppycontrol,  Up: Commands

floppymeter
===========

     `floppymeter' [`-f'] [`-w' WARMUP-DELAY] [`-W' WINDOW]
     [`-c' CYCLES] [`-h'] DRIVE

   The `floppymeter' program measures characteristic parameters of a
floppy drive and floppy controller, such as the rotation speed of the
drive, the data transfer rate of the controller, and the resulting raw
capacity of a disk track.  To use this program, insert a disposable
floppy in the drive, and type `floppymeter --'DENSITY, where density
describes the density of the disk used for the test. (Should be one of
`dd, hd' or `ed'). *CAUTION: the data on the disk will be erased*.
This program should be used to verify whether the drive and controller
are out of tolerance if you experience problems with some high capacity
formats.  It only needs to be run once per drive: although a disk is
needed to perform the measurements, the measured data only depend on
the drive and the controller, and not on the disk.

   To measure the raw capacity of the disk track, the floppymeter
program formats the first track of the drive in a special way that
allows it to read the raw data (gaps and headers) of the disk. *Thus,
all data previously stored on that disk is lost*.

   The rotation speed is measured by timing the return time of a
`readid' command.  In order to gain more precision, the command is
issued many times in a row. During this phase, the number of rotations
til the start of the test, the average time per rotation til the start,
and a sliding average of the times of the last 30 rotations is printed,
and updated continously.

   The data transfer rate is deduced from the two parameters above.

   At the end of the program, all parameters (raw capacity, duration of
one rotation, and data transfer rate) are printed again, as well as
their relative deviation to the standard value.  Finally, it suggests a
capacity deviation description line, which can be directly pasted into
the drive definition file (*Note Drive descriptions::.).

   Usually, the data transfer rate should not deviate more than 150 ppm
from the expected value, and the rotation speed of the drive should not
deviate more than 3000 ppm from the expected value.  If these deviations
are bigger, you may get problems with certain high capacity formats.

   If the raw capacity of the drive is too small, some high capacity
formats may become unformattable on this drive/controller combo.

   If on the other hand, the raw capacity of the drive is too big, you
may get problems when writing to a disk formatted by this drive on
another drive with a smaller raw capacity. In order to avoid this,
increase superformats gap parameter (`-G').

`-h'
     Prints a short help

`--dd'
     Tells the program that we use a Double Density disk.

`--hd'
     Tells the program that we use a High Density disk.

`--ed'
     Tells the program that we use an Extra Density disk.

`-f'
     Runs the measurement non interactively.  With this option, the
     program doesn't ask for confirmation, and doesn't display the
     continously updated values during the rotation speed measurement.

`-W WINDOW'
     This value describes how many rotations are used for the
     computation of the sliding average. Default is 30.

`-c CYCLES'
     Describes the number of rotations clocked during the rotations
     speed determination test. Default is 1000.


Bugs
----

This program is quite new, and may have bugs. Here are a few suggested
tests to check its sanity:
   * The deviation of the data transfer rate solely depends on the
     controller. It should not be different between two drives
     connected to the same controller. However, the drive rotation
     speed may be different for different drives.

   * All data transfer rates (for double, high and extra density) are
     derived from a same master frequency. Thus the _deviation_ of the
     data transfer rate should be independant of the density used.

File: fdutils.info,  Node: getfdprm,  Next: makefloppies,  Prev: floppymeter,  Up: Commands

getfdprm
========

     `getfdprm' [DRIVE]

   `getfdprm' prints the current geometry information for DRIVE .  This
information can be set using `setfdprm'

File: fdutils.info,  Node: makefloppies,  Next: setfdprm,  Prev: getfdprm,  Up: Commands

makefloppies
============

     `MAKEFLOPPIES' [`-tlvng'] [DRIVES]

   The `MAKEFLOPPIES' shell script creates the new floppy block device
node.  It uses the floppycontrol program to translate the minor device
numbers into meaningful names. It also uses these names to decide
whether to create a given block device file or not, depending on the
type of the physical drive (for instance, for a 3 1/2 drive, the formats
corresponding to a 5 1/4 drive are not created).

   If you have more than two floppy drives, you need to tell the kernel
the CMOS types of those additional drives using the
`floppy='DRIVE`,'TYPE`,cmos' lilo option.

   If the DRIVES  parameter is given, only the device nodes for the
listed drives are made. By default, all only the two first drives are
tried.

   `MAKEFLOPPIES' does not work if you redefine your default formats.

   *Caution*: `MAKEFLOPPIES' removes already existing floppy device
nodes.

Options
-------

`-t'
     Use the old naming convention for 3 1/2 devices (e.g. `fd0H720'
     instead of `fd0u720').

`-m'
     Base the name for the created devices on the type of the media
     (e.g. `fd0h720' instead of `fd0u720').

`-l'
     Local. Creates device nodes in the local directory, not /dev

`-v'
     Verbose

`-n'
     Dry run. (just report what would be done, do not do anything)

`-g'
     Group.  Allow read/write access to floppy devices only for group
     `floppy'


Bugs
----

The Makefloppies script does not work on redefined "default" formats, If
you redefine default formats, you need to create the needed device nodes
manually.

File: fdutils.info,  Node: superformat,  Next: xdfcopy,  Prev: setfdprm,  Up: Commands

superformat
===========

     `superformat' [`-D' DOS-DRIVE] [`-v' VERBOSITY-LEVEL] [`-b' BEGIN-TRACK]
     [`-e' END-TRACK] [`--superverify'] [`--dosverify']
     [`--noverify'] [`--verify_later'] [`--zero-based']
     [`-G' FORMAT-GAP] [`-F' FINAL-GAP] [`-i' INTERLEAVE] [`-c' CHUNKSIZE]
     [`-g' GAP] [`--absolute-skew' ABSOLUTE-SKEW] [`--head-skew' HEAD-SKEW]
     [`--track-skew' TRACK-SKEW] [`--biggest-last'] DRIVE [MEDIA-DESCRIPTION]

   `superformat' is used to format disks with a capacity of up to 1992K
HD or 3984K ED.  *Note Extended formats::, for a detailed description
of these formats. *Note Media description::, for a detailed description
of the syntax for the media description.  If no media description is
given, superformat formats a disk in the highest available density for
that drive, using standard parameters (i.e. no extra capacity formats).

   When the disk is formatted, `superformat' automatically invokes
`mformat' in order to put an MS-DOS filesystem on it. You may ignore
this filesystem, if you don't need it.

   Supeformat allows to format 2m formats.  Be aware, however, that
these `2m' formats were specifically designed to hold an MS-DOS
filesystem, and that they take advantage of the fact that the MS-DOS
filesystem uses redundant sectors on the first track (the FAT, which is
represented twice). The second copy of the FAT is _not_ represented on
the disk.

   High capacity formats are sensitive to the exact rotation speed of
the drive and the resulting difference in raw capacity.  That's why
`superformat' performs a measurement of the disks raw capacity before
proceeding with the formatting.  This measurement is rather time
consuming, and can be avoided by storing the relative deviation of the
drive capacity into the drive definition file file. *Note Drive
descriptions::, for more details on this file. The line to be inserted
into the drive definition file is printed by superformat after
performing its measurement.  However, this line depends on the drive and
the controller.  Do not copy it to other computers.  Remove it before
installing another drive or upgrade your floppy controller.  Swap the
drive numbers if you swap the drives in your computer.

* Menu:

* Common options::               The most frequently used options
* Advanced options::             For experts
* Sector skewing options::       Optimizing throughput by creatively
                                 arranging the sectors
* Examples::                     Some example command lines
* Troubleshooting::              Most common failure modes
* Superformat bugs::             Nobody is perfect

File: fdutils.info,  Node: Common options,  Next: Advanced options,  Prev: superformat,  Up: superformat

Common Options
--------------

Many options have a long and a short form.

`-h'
`--help'
     Print the help.

`-D DRIVE'
`--dosdrive DOS-DRIVE'
     Selects DOS drive letter for `mformat' (for example `a:' or `b:').
     The colon may be omitted.  The default is derived from the minor
     device number.  If the drive letter cannot be guessed, and is not
     given on the command line, `mformat' is skipped.

`-v VERBOSITY-LEVEL'
`--verbosity VERBOSITY-LEVEL'
     Sets the verbosity level. 1 prints a dot for each formatted track.
     2 prints a changing sign for each formatted track (- for
     formatting the first head, = for formatting the second head, x for
     verifying the first head, and + for verifying the second head). 3
     prints a complete line listing head and track. 6 and 9 print
     debugging information.

`--superverify'
     Verifies the disk by first reading the track, than writing a
     pattern of U's, and then reading it again.  This is useful as some
     errors only show up after the disk has once been written.
     However, this is also slower.

`-B'
`--dosverify'
     Verifies the disk using the `mbadblocks' program.  `mbadblocks'
     marks the bad sectors as bad in the FAT.  The advantage of this is
     that disks which are only partially bad can still be used for
     MS-DOS filesystems.

`-V0'
     Verifies the whole disk at each track instead of at the end of the
     formatting process.  Verifying the disk at each track has the
     advantage of detecting errors early on, but it may fail due to the
     kernel read ahead mechanism, which may try to access not yet
     formatted tracks.

`-f'
`--noverify'
     Skips the verification altogether.


File: fdutils.info,  Node: Advanced options,  Next: Sector skewing options,  Prev: Common options,  Up: superformat

Advanced Options
----------------

Usually, superformat uses sensible default values for these options,
which you normally don't need to override.  They are intended for expert
users.  Most of them should only be needed in cases where the hardware
or superformat itself has bugs.

`-b BEGIN-TRACK'
`--begin_track  BEGIN-TRACK'
     Describes the track where to begin formatting.  This is useful if
     the previous formatting failed halfway through.  The default is 0.

`-e END-TRACK'
`--end_track END-TRACK'
     Describes where to stop formatting. END_TRACK is the last track to
     be formatted plus one. This is mainly useful for testing purposes.
     By default, this is the same as the total number of tracks.  When
     the formatting stops, the final skew is displayed (to be used as
     absolute skew when you'll continue).

`-S SIZECODE'
`--sizecode SIZECODE'
     Set the sector size to be used. The sector size is 128 * (2 ^
     SIZECODE).  Sector sizes below 51