fdformat

Format floppy diskettes (QNX)

Syntax:

fdformat [-aiIpqv] [-h heads] [-t tracks] [-n sectors]
         [-s size] [-k skew_factor] [-z interlv] drive

Runs on:

Neutrino

Options:

-a
Abort on the first error encountered.
-h heads
The number of heads.
-I
Ignore errors. Don't try to verify diskette.
-i
Write layout information to the diskette, but don't format it.
-k skew_factor
The number of sectors by which fdformat should offset the starting sector of a track from the last sector of the previous track.
-n sectors
The number of sectors per track.
-p
Prompt before starting.
-q
Be quiet; don't report progress as each track is formatted.
-s size
The disk media: 360K, 720K, 1.2M, 1.4M, or 2.8M (overrides -h, -t, and -n).
-t tracks
The number of tracks.
-v
Be verbose; display extra information as the format progresses.
-z interlv
The interleave amount.
drive
The name of the physical device to be formatted (i.e. /dev/fd0).

Description:

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:

Size Heads Tracks Sectors Drive type
360K 2 40 9 5¼″ floppy
720K 2 80 9 3½″ floppy
1.2M 2 80 15 5¼″ floppy
1.44M 2 80 18 3½″ floppy
2.88M 2 80 36 3½″ floppy

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:

    -k 5

Placing the first sector of the next track five sectors away from the current sector minimizes the latency effects.

Examples:

Format the diskette mounted as /dev/fd0 using the current mount parameters:

    fdformat /dev/fd0

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

Files:

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.

Exit status:

0
The disk was formatted successfully.
>0
An error occurred and a diagnostic message was written to the standard error.

Caveats:

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.