MKDOSFS(1)

NAME
mkdosfs - create an MS-DOS (FAT) file system

SYNOPSIS
mkdosfs [-f capacity] [-L vollabel] device

DESCRIPTION
Mkdosfs establishes a file system structure on device that is understood by mount_msdos and some ancient program loader. Device will typically be the character device node for a floppy disk drive, (e. g. /dev/rfd0), although any existing writable file or device is acceptable. In case of a regular file it is treated as a dumped image of an MS-DOS file system; only the file system structure will be written to it, and it won't be truncated.

The options are as follows:

-f capacity
    Use defaults for a typical file system with capacity kilobytes. Currently, the values 360, 720, 1200, and 1440 are recognized.

    If this option is not specified, mkdosfs attempts to determine the size of the device. This is not reliably possible in all cases, but is believed to work for the more common situations.

-L vollabel
    Use vollabel to describe the file system, instead of the default ‘4.4BSD’.

The file system structure consists of three major areas:

The bootsector
    This is the very first (512-byte) sector. It contains executable code that normally would bootstrap an operating system when loaded. Since it's beyond the scope of mkdosfs to install an operating system on the medium, this boot code will only print a message that the disk does not contain a bootable system. Inside the bootsector is the BIOS parameter block (BPB), where several statistical parameters of the file system are being held.

The file allocation table(s) (FAT)
    Sectors next to the bootsector hold the FAT, which is used to register file system allocation, as well as keeping pointer chains for the chunks constituting one file. There are usually two identical copies of the FAT.

The root directory
    The final structure is the root directory for this medium. It is merely a space reservation, padded with 0's, and unfortunately fixed in its size. mkdosfs initializes it to empty, and enters a volume label record into the very first directory slot.

DIAGNOSTICS
An exit status of 0 is returned upon successful operation. Exit status 1 is returned on any errors during file system creation, and an exit status of 2 reflects invalid arguments given to the program (along with an appropriate information written to diagnostic output).

SEE ALSO
fdformat(1), mount_msdos(8), newfs(8).

BUGS
There is currently no way to specify obscure file system parameters. Thus, only media with one of the supported capacity values can be formatted. For the same reason, it's not possible to handle hard disk partitions. More options should be added to allow this. More entries should be added to the table of known formats, too.

No attempt is made to handle media defects. However, this is beyond the scope of mkdosfs and should better be handled by the (nonexistent) dosfsck(1) utility.

HISTORY
Mkdosfs appeared in FreeBSD 2.2.

AUTHOR
The program has been contributed by Joerg Wunsch, Dresden.