mkfatfs − create a FAT file system
mkfatfs [options] device
mkfatfs is used to create a FAT file system on a device (usually a disk or flash partition). device is the special file corresponding to the device (e.g. /dev/sdXX, /dev/block/mmcblk1p1).
Below is a summary of all the options that mkfatfs accepts. Nearly all options have two equivalent names. The short name is preceded by − and the long name is preceded by −−.
−f, −−force
Allow formatting a FAT volume for which the physical sector size cannot be automatically detected (for example an image file).
−l, −−volume−label STRING
Set the volume label for the filesystem. The volume label can be up to 11 ASCII units long, i.e. in most cases 11 bytes.
−i, −−volume−id STRING
Sets the volume-id for the volume to STRING.
−r, −−rootdir−entries NUMBER
Set the count of 32 bytes directory entries in the root directory to NUMBER. For FAT32 volumes this value is ignored and set to zero. For FAT 12/16 volume the default value is 512.
−f, −−fat−type FATBITS
Set the FAT bits for the volume to FATBITS. The legal values for this field are [12, 16, 32].
−S, −−sector−size SIZE
Set the volume sector size (in bytes) to SIZE. The default is to detect sector size automatically. Note: This option should probably never be used when formatting devices directly as most FAT drivers won’t be able to use a FAT volume where the volume sector size doesn’t match the physical sector size.
−s, −−sectors−per−cluster VALUE
Set the volume cluster size (in bytes) to VALUE * sector_size. The default value is calculated dynamically depending on FAT type (FAT 12/16/32) and the size of the volume. The legal values for this field are [1, 2, 4, 8, 16, 32, 64, 128], such that VALUE * sector_size does not exceed 32K.
−v, −−verbose
Makes mkfatfs emit certain status messages related to the formatting process.
−−sda−strict
Forces the formatted volume to adhere to SD Association recommendations.
−−sda−whole
Performs a whole device formatting, including partition table, according to the SD Association recommendations. This option should only be used with whole devices (e.g. /dev/mmcblk0) and never partitions (e.g. /dev/mmcblk0p1).
−−sda−relax
Relaxes sanity checks for −−sda−strict and −−sda−whole to allow formatting devices that don’t comply to the size specifications of SD cards to be formatted according to the SD Association guidelines.
NOTE: This option is only a modifier to −−sda−strict and −−sda−whole and does not do anything on its own.
−−discard
This option sends a ’discard’ command, like TRIM, to the device which will zero all data on it.
If you find a bug please send an email describing the problem to fat-support@tuxera.com.
mkfatfs was written by Sougata Santra, Tuxera Inc.
mkfatfs is part of the Tuxera FATprogs package.