1MKFS.FAT(8) dosfstools MKFS.FAT(8)
2
3
4
6 mkfs.fat - create an MS-DOS filesystem under Linux
7
9 mkfs.fat [ -a ] [ -A ] [ -b sector-of-backup ] [ -c ] [ -l filename ] [
10 -C ] [ -f number-of-FATs ] [ -F FAT-size ] [ -h number-of-hidden-sec‐
11 tors ] [ -i volume-id ] [ -I ] [ -m message-file ] [ -n volume-name ] [
12 -r root-dir-entries ] [ -R number-of-reserved-sectors ] [ -s sectors-
13 per-cluster ] [ -S logical-sector-size ] [ -v ] device [ block-count ]
14
16 mkfs.fat is used to create an MS-DOS filesystem under Linux on a device
17 (usually a disk partition). device is the special file corresponding
18 to the device (e.g /dev/hdXX). block-count is the number of blocks on
19 the device. If omitted, mkfs.fat automatically determines the filesys‐
20 tem size.
21
23 -a Normally, for any filesystem except very small ones, mkfs.fat
24 will align all the data structures to cluster size, to make sure
25 that as long as the partition is properly aligned, so will all
26 the data structures in the filesystem. This option disables
27 alignment; this may provide a handful of additional clusters of
28 storage at the expense of a significant performance degradation
29 on RAIDs, flash media or large-sector hard disks.
30
31 -A Use Atari variation of the MS-DOS filesystem. This is default if
32 mkfs.fat is run on an Atari, then this option turns off Atari
33 format. There are some differences when using Atari format: If
34 not directed otherwise by the user, mkfs.fat will always use 2
35 sectors per cluster, since GEMDOS doesn't like other values very
36 much. It will also obey the maximum number of sectors GEMDOS
37 can handle. Larger filesystems are managed by raising the logi‐
38 cal sector size. Under Atari format, an Atari-compatible serial
39 number for the filesystem is generated, and a 12 bit FAT is used
40 only for filesystems that have one of the usual floppy sizes
41 (720k, 1.2M, 1.44M, 2.88M), a 16 bit FAT otherwise. This can be
42 overridden with the -F option. Some PC-specific boot sector
43 fields aren't written, and a boot message (option -m) is
44 ignored.
45
46 -b sector-of-backup
47 Selects the location of the backup boot sector for FAT32.
48 Default depends on number of reserved sectors, but usually is
49 sector 6. The backup must be within the range of reserved sec‐
50 tors.
51
52 -c Check the device for bad blocks before creating the filesystem.
53
54 -C Create the file given as device on the command line, and write
55 the to-be-created filesystem to it. This can be used to create
56 the new filesystem in a file instead of on a real device, and to
57 avoid using dd in advance to create a file of appropriate size.
58 With this option, the block-count must be given, because other‐
59 wise the intended size of the filesystem wouldn't be known. The
60 file created is a sparse file, which actually only contains the
61 meta-data areas (boot sector, FATs, and root directory). The
62 data portions won't be stored on the disk, but the file never‐
63 theless will have the correct size. The resulting file can be
64 copied later to a floppy disk or other device, or mounted
65 through a loop device.
66
67 -f number-of-FATs
68 Specify the number of file allocation tables in the filesystem.
69 The default is 2. Currently the Linux MS-DOS filesystem does
70 not support more than 2 FATs.
71
72 -F FAT-size
73 Specifies the type of file allocation tables used (12, 16 or 32
74 bit). If nothing is specified, mkfs.fat will automatically
75 select between 12, 16 and 32 bit, whatever fits better for the
76 filesystem size.
77
78 -h number-of-hidden-sectors
79 Select the number of hidden sectors in the volume. Apparently
80 some digital cameras get indigestion if you feed them a CF card
81 without such hidden sectors, this option allows you to satisfy
82 them. Assumes ´0´ if no value is given on the command line.
83
84 -i volume-id
85 Sets the volume ID of the newly created filesystem; volume-id is
86 a 32-bit hexadecimal number (for example, 2e24ec82). The
87 default is a number which depends on the filesystem creation
88 time.
89
90 -I It is typical for fixed disk devices to be partitioned so, by
91 default, you are not permitted to create a filesystem across the
92 entire device. mkfs.fat will complain and tell you that it
93 refuses to work. This is different when using MO disks. One
94 doesn't always need partitions on MO disks. The filesystem can
95 go directly to the whole disk. Under other OSes this is known
96 as the 'superfloppy' format.
97
98 This switch will force mkfs.fat to work properly.
99
100 -l filename
101 Read the bad blocks list from filename.
102
103 -m message-file
104 Sets the message the user receives on attempts to boot this
105 filesystem without having properly installed an operating sys‐
106 tem. The message file must not exceed 418 bytes once line feeds
107 have been converted to carriage return-line feed combinations,
108 and tabs have been expanded. If the filename is a hyphen (-),
109 the text is taken from standard input.
110
111 -n volume-name
112 Sets the volume name (label) of the filesystem. The volume name
113 can be up to 11 characters long. The default is no label.
114
115 -r root-dir-entries
116 Select the number of entries available in the root directory.
117 The default is 112 or 224 for floppies and 512 for hard disks.
118
119 -R number-of-reserved-sectors
120 Select the number of reserved sectors. With FAT32 format at
121 least 2 reserved sectors are needed, the default is 32. Other‐
122 wise the default is 1 (only the boot sector).
123
124 -s sectors-per-cluster
125 Specify the number of disk sectors per cluster. Must be a power
126 of 2, i.e. 1, 2, 4, 8, ... 128.
127
128 -S logical-sector-size
129 Specify the number of bytes per logical sector. Must be a power
130 of 2 and greater than or equal to 512, i.e. 512, 1024, 2048,
131 4096, 8192, 16384, or 32768.
132
133 -v Verbose execution.
134
136 mkfs.fat can not create boot-able filesystems. This isn't as easy as
137 you might think at first glance for various reasons and has been dis‐
138 cussed a lot already. mkfs.fat simply will not support it ;)
139
141 Dave Hudson - <dave@humbug.demon.co.uk>; modified by Peter Anvin
142 <hpa@yggdrasil.com>. Fixes and additions by Roman Hodek
143 <roman@hodek.net> for Debian GNU/Linux.
144
146 mkfs.fat is based on code from mke2fs (written by Remy Card -
147 <card@masi.ibp.fr>) which is itself based on mkfs (written by Linus
148 Torvalds - <torvalds@cs.helsinki.fi>).
149
151 fsck.fat(8), fatlabel(8), mkfs(8)
152
153
154
1553.0.19 2013-06-11 MKFS.FAT(8)