1MKFS.FAT(8)                 System Manager's Manual                MKFS.FAT(8)
2
3
4

NAME

6       mkfs.fat - create an MS-DOS FAT filesystem
7

SYNOPSIS

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

DESCRIPTION

12       mkfs.fat  is used to create a FAT filesystem on a device or in an image
13       file.  DEVICE is the special file corresponding  to  the  device  (e.g.
14       /dev/sdXX) or the image file (which does not need to exist when the op‐
15       tion -C is given).  BLOCK-COUNT is the number of blocks on  the  device
16       and size of one block is always 1024 bytes, independently of the sector
17       size or the cluster size.   Therefore  BLOCK-COUNT  specifies  size  of
18       filesystem  in  KiB unit and not in the number of sectors (like for all
19       other mkfs.fat options).  If omitted, mkfs.fat automatically chooses  a
20       filesystem size to fill the available space.
21
22       Two  different  variants of the FAT filesystem are supported.  Standard
23       is the FAT12, FAT16 and FAT32 filesystems as defined by  Microsoft  and
24       widely  used  on  hard disks and removable media like USB sticks and SD
25       cards.  The other is the legacy Atari variant used on Atari ST.
26
27       In Atari mode, if not directed otherwise by the user, mkfs.fat will al‐
28       ways  use 2 sectors per cluster, since GEMDOS doesn't like other values
29       very much.  It will also obey the maximum number of sectors GEMDOS  can
30       handle.   Larger  filesystems are managed by raising the logical sector
31       size.  An Atari-compatible serial number for the filesystem  is  gener‐
32       ated,  and  a  12 bit FAT is used only for filesystems that have one of
33       the usual floppy sizes (720k, 1.2M, 1.44M, 2.88M), a 16 bit FAT  other‐
34       wise.   This  can  be  overridden with the -F option.  Some PC-specific
35       boot sector fields aren't written, and a boot message  (option  -m)  is
36       ignored.
37

OPTIONS

39       -a  Normally,  for any filesystem except very small ones, mkfs.fat will
40           align all the data structures to cluster size, to make sure that as
41           long  as  the  partition  is properly aligned, so will all the data
42           structures in the filesystem.  This option disables alignment; this
43           may  provide a handful of additional clusters of storage at the ex‐
44           pense of a significant performance degradation on RAIDs, flash  me‐
45           dia or large-sector hard disks.
46
47       -A  Select  using  the  Atari  variation  of the FAT filesystem if that
48           isn't active already, otherwise  select  standard  FAT  filesystem.
49           This is selected by default if mkfs.fat is run on 68k Atari Linux.
50
51       -b SECTOR-OF-BACKUP
52           Selects  the location of the backup boot sector for FAT32.  Default
53           depends on number of reserved sectors, but usually is sector 6.  If
54           there  is  a free space available after the backup boot sector then
55           backup of the FAT32 info sector is put after the backup  boot  sec‐
56           tor,  usually  at sector 7.  The backup must be within the range of
57           reserved sectors.  Value 0 completely disables creating  of  backup
58           boot and info FAT32 sectors.
59
60       -c  Check the device for bad blocks before creating the filesystem.
61
62       -C  Create  the file given as DEVICE on the command line, and write the
63           to-be-created filesystem to it.  This can be used to create the new
64           filesystem  in a file instead of on a real device, and to avoid us‐
65           ing dd in advance to create a file of appropriate size.  With  this
66           option,  the  BLOCK-COUNT  must be given, because otherwise the in‐
67           tended size of the filesystem wouldn't be known.  The file  created
68           is  a sparse file, which actually only contains the meta-data areas
69           (boot sector, FATs, and root directory).  The data  portions  won't
70           be stored on the disk, but the file nevertheless will have the cor‐
71           rect size.  The resulting file can be copied later to a floppy disk
72           or other device, or mounted through a loop device.
73
74       -D DRIVE-NUMBER
75           Specify  the BIOS drive number to be stored in the FAT boot sector.
76           For hard disks and removable medias it is usually  0x80–0xFF  (0x80
77           is  first  hard  disk  C:,  0x81  is second hard disk D:, ...), for
78           floppy devices or partitions to be used for floppy emulation it  is
79           0x00–0x7F (0x00 is first floppy A:, 0x01 is second floppy B:).
80
81       -f NUMBER-OF-FATS
82           Specify  the  number  of  file allocation tables in the filesystem.
83           The default is 2.
84
85       -F FAT-SIZE
86           Specifies the type of file allocation tables used  (12,  16  or  32
87           bit).   If nothing is specified, mkfs.fat will automatically select
88           between 12, 16 and 32 bit, whatever fits better for the  filesystem
89           size.
90
91       -g HEADS/SECTORS-PER-TRACK
92           Specify  HEADS  and SECTORS-PER-TRACK numbers which represents disk
93           geometry of DEVICE.  Both numbers are stored into the FAT boot sec‐
94           tor.   Number SECTORS-PER-TRACK is used also for aligning the total
95           count of FAT sectors.  By default disk geometry is read from DEVICE
96           itself.   If  it  is  not available then LBA-Assist Translation and
97           translation table from the SD Card Part 2 File System Specification
98           based on total number of disk sectors is used.
99
100       -h NUMBER-OF-HIDDEN-SECTORS
101           Specify  the  number  of so-called hidden sectors, as stored in the
102           FAT boot sector: this number represents the beginning sector of the
103           partition  containing  the file system.  Normally this is an offset
104           (in sectors) relative to the start of the disk,  although  for  MBR
105           logical  volumes contained in an extended partition of type 0x05 (a
106           non-LBA extended partition), a quirk in the  MS-DOS  implementation
107           of FAT requires it to be relative to the partition's immediate con‐
108           taining Extended Boot Record.  Boot code and  other  software  han‐
109           dling  FAT  volumes  may  also rely on this field being set up cor‐
110           rectly; most modern FAT implementations will  ignore  it.   By  de‐
111           fault, if the DEVICE is a partition block device, mkfs.fat uses the
112           partition offset relative to disk start.  Otherwise,  mkfs.fat  as‐
113           sumes zero.  Use this option to override this behaviour.
114
115       -i VOLUME-ID
116           Sets  the volume ID of the newly created filesystem; VOLUME-ID is a
117           32-bit hexadecimal number (for example, 2e24ec82).  The default  is
118           a number which depends on the filesystem creation time.
119
120       -I  Ignore  and  disable safety checks.  By default mkfs.fat refuses to
121           create a filesystem on a device with partitions or virtual mapping.
122           mkfs.fat  will complain and tell you that it refuses to work.  This
123           is different when using MO disks.  One doesn't always  need  parti‐
124           tions  on  MO  disks.   The filesystem can go directly to the whole
125           disk.  Under other OSes this is known as  the  superfloppy  format.
126           This switch will force mkfs.fat to work properly.
127
128       -l FILENAME
129           Read the bad blocks list from FILENAME.
130
131       -m MESSAGE-FILE
132           Sets  the  message  the  user  receives  on  attempts  to boot this
133           filesystem without having properly installed an  operating  system.
134           The  message  file  must  not exceed 418 bytes once line feeds have
135           been converted to carriage return-line feed combinations, and  tabs
136           have  been  expanded.  If the filename is a hyphen (-), the text is
137           taken from standard input.
138
139       -M FAT-MEDIA-TYPE
140           Specify the media type to be stored in the FAT boot  sector.   This
141           value  is  usually  0xF8 for hard disks and is 0xF0 or a value from
142           0xF9 to 0xFF for floppies or partitions to be used for floppy  emu‐
143           lation.
144
145       --mbr[=y|yes|n|no|a|auto]
146           Fill  (fake)  MBR  table  with  disk  signature one partition which
147           starts at sector 0 (includes MBR itself) and spans whole  disk  de‐
148           vice.   It is needed only for non-removable disks used on Microsoft
149           Windows systems and only when formatting whole unpartitioned  disk.
150           Location  of  the  disk signature and partition table overlaps with
151           the end of the first FAT sector  (boot  code  location),  therefore
152           there  is no additional space usage.  Default is auto mode in which
153           mkfs.fat put MBR table only for non-removable disks when formatting
154           whole unpartitioned disk.
155
156       -n VOLUME-NAME
157           Sets  the  volume  name (label) of the filesystem.  The volume name
158           can be up to 11 characters long.   Supplying  an  empty  string,  a
159           string  consisting  only  of white space or the string "NO NAME" as
160           VOLUME-NAME has the same effect as not giving the -n  option.   The
161           default is no label.
162
163       --codepage=PAGE
164           Use  DOS codepage PAGE to encode label.  By default codepage 850 is
165           used.
166
167       -r ROOT-DIR-ENTRIES
168           Select the minimal number of entries available in the  root  direc‐
169           tory.   The  default  is  112  or 224 for floppies and 512 for hard
170           disks.  Note that this is minimal number and it may be increased by
171           mkfs.fat  due to alignment of structures.  See also mkfs.fat option
172           -a.
173
174       -R NUMBER-OF-RESERVED-SECTORS
175           Select the minimal number of reserved sectors.  With  FAT32  format
176           at  least 2 reserved sectors are needed, the default is 32.  Other‐
177           wise the default is 1 (only the boot sector).  Note  that  this  is
178           minimal number and it may be increased by mkfs.fat due to alignment
179           of structures.  See also mkfs.fat option -a.
180
181       -s SECTORS-PER-CLUSTER
182           Specify the number of disk sectors per cluster.  Must be a power of
183           2, i.e. 1, 2, 4, 8, ... 128.
184
185       -S LOGICAL-SECTOR-SIZE
186           Specify the number of bytes per logical sector.  Must be a power of
187           2 and greater than or equal to 512, i.e.  512,  1024,  2048,  4096,
188           8192,  16384, or 32768.  Values larger than 4096 are not conforming
189           to the FAT file system specification and may not work everywhere.
190
191       -v  Verbose execution.
192
193       --offset SECTOR
194           Write the filesystem at a specific sector  into  the  device  file.
195           This  is useful for creating a filesystem in a partitioned disk im‐
196           age without having to set up a loop device.
197
198       --variant TYPE
199           Create a filesystem of variant TYPE.  Acceptable values  are  stan‐
200           dard and atari (in any combination of upper/lower case).  See above
201           under DESCRIPTION for the differences.
202
203       --help
204           Display option summary and exit.
205
206       --invariant
207           Use constants for normally randomly generated or  time  based  data
208           such  as volume ID and creation time.  Multiple runs of mkfs.fat on
209           the same device create identical results  with  this  option.   Its
210           main purpose is testing mkfs.fat.
211

BUGS

213       mkfs.fat  can  not create boot-able filesystems.  This isn't as easy as
214       you might think at first glance for various reasons and has  been  dis‐
215       cussed a lot already.  mkfs.fat simply will not support it ;)
216

SEE ALSO

218       fatlabel(8), fsck.fat(8)
219

HOMEPAGE

221       The  home  for  the  dosfstools  project  is  its  GitHub  project page
222https://github.com/dosfstools/dosfstools⟩.
223

AUTHORS

225       dosfstools were  written  by  Werner  Almesberger  ⟨werner.almesberger@
226       lrc.di.epfl.ch⟩,  Roman Hodek ⟨Roman.Hodek@informatik.uni-erlangen.de⟩,
227       and others.  Current maintainers are Andreas Bombe ⟨aeb@debian.org⟩ and
228       Pali Rohár ⟨pali.rohar@gmail.com⟩.
229
230
231
232dosfstools 4.2                    2021-01-31                       MKFS.FAT(8)
Impressum