1MKFS.FAT(8) System Manager's Manual MKFS.FAT(8)
2
3
4
6 mkfs.fat - create an MS-DOS filesystem under Linux
7
9 mkfs.fat [OPTIONS] DEVICE [BLOCK-COUNT]
10
12 mkfs.fat is used to create an MS-DOS filesystem under Linux on a device
13 (usually a disk partition). DEVICE is the special file corresponding
14 to the device (e.g. /dev/sdXX). BLOCK-COUNT is the number of blocks on
15 the device. If omitted, mkfs.fat automatically determines the filesys‐
16 tem size.
17
19 -a Normally, for any filesystem except very small ones, mkfs.fat will
20 align all the data structures to cluster size, to make sure that as
21 long as the partition is properly aligned, so will all the data
22 structures in the filesystem. This option disables alignment; this
23 may provide a handful of additional clusters of storage at the
24 expense of a significant performance degradation on RAIDs, flash
25 media or large-sector hard disks.
26
27 -A Use Atari variation of the MS-DOS filesystem. This is default if
28 mkfs.fat is run on an Atari, then this option turns off Atari for‐
29 mat. There are some differences when using Atari format: If not
30 directed otherwise by the user, mkfs.fat will always use 2 sectors
31 per cluster, since GEMDOS doesn't like other values very much. It
32 will also obey the maximum number of sectors GEMDOS can handle.
33 Larger filesystems are managed by raising the logical sector size.
34 Under Atari format, an Atari-compatible serial number for the
35 filesystem is generated, and a 12 bit FAT is used only for filesys‐
36 tems that have one of the usual floppy sizes (720k, 1.2M, 1.44M,
37 2.88M), a 16 bit FAT otherwise. This can be overridden with the -F
38 option. Some PC-specific boot sector fields aren't written, and a
39 boot message (option -m) is ignored.
40
41 -b SECTOR-OF-BACKUP
42 Selects the location of the backup boot sector for FAT32. Default
43 depends on number of reserved sectors, but usually is sector 6.
44 The backup must be within the range of reserved sectors.
45
46 -c Check the device for bad blocks before creating the filesystem.
47
48 -C Create the file given as DEVICE on the command line, and write the
49 to-be-created filesystem to it. This can be used to create the new
50 filesystem in a file instead of on a real device, and to avoid
51 using dd in advance to create a file of appropriate size. With
52 this option, the BLOCK-COUNT must be given, because otherwise the
53 intended size of the filesystem wouldn't be known. The file cre‐
54 ated is a sparse file, which actually only contains the meta-data
55 areas (boot sector, FATs, and root directory). The data portions
56 won't be stored on the disk, but the file nevertheless will have
57 the correct size. The resulting file can be copied later to a
58 floppy disk or other device, or mounted through a loop device.
59
60 -D DRIVE-NUMBER
61 Specify the BIOS drive number to be stored in the FAT boot sector.
62 This value is usually 0x80 for hard disks and 0x00 for floppy
63 devices or partitions to be used for floppy emulation.
64
65 -f NUMBER-OF-FATS
66 Specify the number of file allocation tables in the filesystem.
67 The default is 2.
68
69 -F FAT-SIZE
70 Specifies the type of file allocation tables used (12, 16 or 32
71 bit). If nothing is specified, mkfs.fat will automatically select
72 between 12, 16 and 32 bit, whatever fits better for the filesystem
73 size.
74
75 -h NUMBER-OF-HIDDEN-SECTORS
76 Select the number of hidden sectors in the volume. Apparently some
77 digital cameras get indigestion if you feed them a CF card without
78 such hidden sectors, this option allows you to satisfy them.
79
80 -i VOLUME-ID
81 Sets the volume ID of the newly created filesystem; VOLUME-ID is a
82 32-bit hexadecimal number (for example, 2e24ec82). The default is
83 a number which depends on the filesystem creation time.
84
85 -I It is typical for fixed disk devices to be partitioned so, by
86 default, you are not permitted to create a filesystem across the
87 entire device. mkfs.fat will complain and tell you that it refuses
88 to work. This is different when using MO disks. One doesn't
89 always need partitions on MO disks. The filesystem can go directly
90 to the whole disk. Under other OSes this is known as the 'super‐
91 floppy' format. This switch will force mkfs.fat to work properly.
92
93 -l FILENAME
94 Read the bad blocks list from FILENAME.
95
96 -m MESSAGE-FILE
97 Sets the message the user receives on attempts to boot this
98 filesystem without having properly installed an operating system.
99 The message file must not exceed 418 bytes once line feeds have
100 been converted to carriage return-line feed combinations, and tabs
101 have been expanded. If the filename is a hyphen (-), the text is
102 taken from standard input.
103
104 -M FAT-MEDIA-TYPE
105 Specify the media type to be stored in the FAT boot sector. This
106 value is usually 0xF8 for hard disks and is 0xF0 or a value from
107 0xF9 to 0xFF for floppies or partitions to be used for floppy emu‐
108 lation.
109
110 -n VOLUME-NAME
111 Sets the volume name (label) of the filesystem. The volume name
112 can be up to 11 characters long. The default is no label.
113
114 -r ROOT-DIR-ENTRIES
115 Select the number of entries available in the root directory. The
116 default is 112 or 224 for floppies and 512 for hard disks.
117
118 -R NUMBER-OF-RESERVED-SECTORS
119 Select the number of reserved sectors. With FAT32 format at least
120 2 reserved sectors are needed, the default is 32. Otherwise the
121 default is 1 (only the boot sector).
122
123 -s SECTORS-PER-CLUSTER
124 Specify the number of disk sectors per cluster. Must be a power of
125 2, i.e. 1, 2, 4, 8, ... 128.
126
127 -S LOGICAL-SECTOR-SIZE
128 Specify the number of bytes per logical sector. Must be a power of
129 2 and greater than or equal to 512, i.e. 512, 1024, 2048, 4096,
130 8192, 16384, or 32768. Values larger than 4096 are not conforming
131 to the FAT file system specification and may not work everywhere.
132
133 -v Verbose execution.
134
135 --invariant
136 Use constants for normally randomly generated or time based data
137 such as volume ID and creation time. Multiple runs of mkfs.fat on
138 the same device create identical results with this option. Its
139 main purpose is testing mkfs.fat.
140
141 --help
142 Display option summary and exit.
143
145 mkfs.fat can not create boot-able filesystems. This isn't as easy as
146 you might think at first glance for various reasons and has been dis‐
147 cussed a lot already. mkfs.fat simply will not support it ;)
148
150 fatlabel(8)
151 fsck.fat(8)
152
154 The home for the dosfstools project is its GitHub project page
155 ⟨https://github.com/dosfstools/dosfstools⟩.
156
158 dosfstools were written by Werner Almesberger ⟨werner.almesberger@
159 lrc.di.epfl.ch⟩, Roman Hodek ⟨Roman.Hodek@informatik.uni-erlangen.de⟩,
160 and others. The current maintainer is Andreas Bombe ⟨aeb@debian.org⟩.
161
162
163
164dosfstools 4.1 2016-01-25 MKFS.FAT(8)