format floppy diskettes (QNX)
fdformat [-aipqv] [-h heads] [-t tracks] [-n sectors] [-s size] [-f first_track] [-l last_track] [-k skew_factor] [-z interlv] drive
Format the diskette mounted as /dev/fd0 using the current mount parameters:
fdformat /dev/fd0
Format a 1.2Mb diskette mounted as /dev/fd0:
fdformat -s 1.2M /dev/fd0
Format a 1.2Mb diskette mounted as /dev/fd0 using an interleave of 3 because the diskette will be used as a boot diskette:
fdformat -s 1.2M -z 3 /dev/fd0
The fdformat utility formats the specified disk. Formatting refers to a process of placing addressing marks and other control information on the disk to allow the hardware to read it. Formatting does not imply any sort of filesystem structure.
By default, fdformat uses the current mount characteristics of the drive as the drive parameters. These parameters may be overridden by specific command-line options, such as -t tracks.
The -s size option lets you specify the size of standard floppy disks, as in the following:
Size | Heads | Tracks | Sectors | Drive type |
---|---|---|---|---|
360K | 2 | 40 | 9 | 5.25" floppy |
720K | 2 | 80 | 9 | 3.5" floppy |
1.2M | 2 | 80 | 15 | 5.25" floppy |
1.44M | 2 | 80 | 18 | 3.5" floppy |
QNX may mark disks with a volume label. This label allows easy identification of a disk by software (for more information, see dinit). By default, fdformat will refuse to format a disk if it encounters a volume label.
The first sector of QNX floppy disks contains some information about the layout of the diskette (heads, tracks, sectors). The -i option simply writes this layout information to a diskette without formatting it.
The -k skew_factor option provides important tuning for disks. Most disks have an inherent latency when moving from one track to the next. The duration of this latency depends upon the architecture of the drive.
If this latency is, for example, five sectors, you would specify the following:
-k 5
Placing the first sector of the next track five sectors away from the current sector minimizes the latency effects.
The -z interlv option lets you specify the amount of interleave (spacing between sectors). Specifying -z1 (the default) would place the sectors contiguously (e.g. 1,2,3,4,5, etc.)
Specifying -z2 would place the sectors at every second location (e.g. 1, -, 2, -, 3, -, 4, -, 5, etc.). If there were nine sectors per track, -z2 would yield:
1, 6, 2, 7, 3, 8, 4, 9, 5
such that reading every other sector in the (circular) track would produce a contiguous reading of the sectors. Note that the hardware makes all of this transparent; specifying -z may optimize access for the hardware.
If the -p is specified, fdformat will pause until it is able to read a newline character from the standard input before proceeding to format the specified disk. The standard input is otherwise unused.
If not in quiet mode (i.e. -q is not specified), informational and progress messages will be written to the standard output as the formatting proceeds. The extent of this information is influenced by the -v option. If -q is specified, this information will not be written. Note that -q does not override the printing of the prompt for the -p (pause) option.
Any errors which occur will cause a diagnostic message to be written to the standard error. In addition, if the -v option is specified, information relating to some of the specific formatting steps may be written to the standard error.
The fdformat utility acts upon the block special file named on the command line. The contents of the medium represented by this file will be destroyed on successful invocation of the utility.
The fdformat utility will permanently destroy any existing data on a diskette. You should not count on this behavior for data security — differences in physical drive characteristics and presence of magnetic fields in fringe areas may result in the data being recoverable by use of special instruments. If you want to destroy data, the only really safe way is to completely destroy the media.
Note that the latency saved by tuning the disk skew factor is only realized when reading sequentially across a track boundary. On random requests, there is no single mechanism to minimize access time.