Format floppy diskettes (QNX)
fdformat [-aiIpqv] [-h heads] [-t tracks] [-n sectors] [-s size] [-k skew_factor] [-z interlv] drive
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 doesn't 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:
The first sector of QNX Neutrino 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 -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.
The -k skew_factor option affects performance when reading and writing consecutive tracks on the disk in an ascending order. Disk drives have an inherent latency when moving the head from one track to the next. By setting the first sector of the next track some distance ahead of the last sector of the current track, it is possible to tune the amount of time it takes before the head encounters the first sector of the next track after the seek. When there is no skew, the rotation of the disk places the head past the first sector of the next track after the time taken to seek to the next track, meaning that to get to the first sector the disk must complete nearly a full rotation.
If the latency is, for example, five sectors, you would specify the following:
Placing the first sector of the next track five sectors away from the current sector minimizes the latency effects.
Format the diskette mounted as /dev/fd0 using the current mount parameters:
Format a 1.4M diskette mounted as /dev/fd0:
fdformat -s 1.4M /dev/fd0
Format a 1.4M diskette mounted as /dev/fd0 using an interleave of 3 because the diskette will be used as a boot diskette:
fdformat -s 1.4M -z 3 /dev/fd0
If the -p is specified, fdformat pauses until gets 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 isn't specified), informational and progress messages are 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 isn't written. Note that -q doesn't override the printing of the prompt for the -p (pause) option.
Any errors which occur 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. If successful, fdformat destroys the contents of the medium represented by this file.
The fdformat utility destroys any existing data on a diskette. Don't 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.
dcheck, devb-fdc, dinit