Linux "mkfs.vfat" Command Line Options and Examples
create an MS-DOS filesystem under Linux

mkfs.fat is used to create an MS-DOS filesystem under Linux on a device (usually a disk partition). DEVICE is the special file cor‐ responding to the device (e.


Usage:

mkfs.fat [OPTIONS] DEVICE [BLOCK-COUNT]






Command Line Options:

-b
Selects the location of the backup boot sector for FAT32. Default depends on number of reserved sectors, but usually is sector6. The backup must be within the range of reserved sectors.
mkfs.vfat -b ...
-c
Check the device for bad blocks before creating the filesystem.
mkfs.vfat -c ...
-D
Specify the BIOS drive number to be stored in the FAT boot sector. This value is usually 0x80 for hard disks and 0x00 for floppydevices or partitions to be used for floppy emulation.
mkfs.vfat -D ...
-f
Specify the number of file allocation tables in the filesystem. The default is 2.
mkfs.vfat -f ...
-F
Specifies the type of file allocation tables used (12, 16 or 32 bit). If nothing is specified, mkfs.fat will automaticallyselect between 12, 16 and 32 bit, whatever fits better for the filesystem size.
mkfs.vfat -F ...
-h
Select the number of hidden sectors in the volume. Apparently some digital cameras get indigestion if you feed them a CF cardwithout such hidden sectors, this option allows you to satisfy them.
mkfs.vfat -h ...
-i
Sets the volume ID of the newly created filesystem; VOLUME-ID is a 32-bit hexadecimal number (for example, 2e24ec82). Thedefault is a number which depends on the filesystem creation time.
mkfs.vfat -i ...
-l
Read the bad blocks list from FILENAME.
mkfs.vfat -l ...
-m
Sets the message the user receives on attempts to boot this filesystem without having properly installed an operating system.The message file must not exceed 418 bytes once line feeds have been converted to carriage return-line feed combinations, andtabs have been expanded. If the filename is a hyphen (-), the text is taken from standard input.
mkfs.vfat -m ...
-M
Specify the media type to be stored in the FAT boot sector. This value is usually 0xF8 for hard disks and is 0xF0 or a valuefrom 0xF9 to 0xFF for floppies or partitions to be used for floppy emulation.
mkfs.vfat -M ...
-n
Sets the volume name (label) of the filesystem. The volume name can be up to 11 characters long. The default is no label.
mkfs.vfat -n ...
-r
Select the number of entries available in the root directory. The default is 112 or 224 for floppies and 512 for hard disks.
mkfs.vfat -r ...
-R
Select the number of reserved sectors. With FAT32 format at least 2 reserved sectors are needed, the default is 32. Otherwisethe default is 1 (only the boot sector).
mkfs.vfat -R ...
-s
Specify the number of disk sectors per cluster. Must be a power of 2, i.e. 1, 2, 4, 8, ... 128.
mkfs.vfat -s ...
-S
Specify the number of bytes per logical sector. Must be a power of 2 and greater than or equal to 512, i.e. 512, 1024, 2048,4096, 8192, 16384, or 32768. Values larger than 4096 are not conforming to the FAT file system specification and may not workeverywhere.
mkfs.vfat -S ...
-v
Verbose execution.
mkfs.vfat -v ...
--invariant
Use constants for normally randomly generated or time based data such as volume ID and creation time. Multiple runs of mkfs.faton the same device create identical results with this option. Its main purpose is testing mkfs.fat.
mkfs.vfat --invariant ...
--help
Display option summary and exit.BUGSmkfs.fat can not create boot-able filesystems. This isn't as easy as you might think at first glance for various reasons and hasbeen discussed a lot already. mkfs.fat simply will not support it ;)
mkfs.vfat --help ...