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

NAME

6       fsck.fat - check and repair MS-DOS FAT filesystems
7

SYNOPSIS

9       fsck.fat [OPTIONS] DEVICE
10

DESCRIPTION

12       fsck.fat  verifies the consistency of MS-DOS filesystems and optionally
13       tries to repair them.
14
15       The following filesystem problems can be corrected (in this order):
16
17       •   FAT contains invalid cluster numbers.  Cluster is changed to EOF.
18
19       •   File's cluster chain contains a loop.  The loop is broken.
20
21       •   Bad clusters (read errors).  The clusters are marked bad  and  they
22           are removed from files owning them.  This check is optional.
23
24       •   Directories  with a large number of bad entries (probably corrupt).
25           The directory can be deleted.
26
27       •   Files . and .. are non-directories.  They can  be  deleted  or  re‐
28           named.
29
30       •   Directories . and .. in root directory.  They are deleted.
31
32       •   Bad filenames.  They can be renamed.
33
34       •   Duplicate directory entries.  They can be deleted or renamed.
35
36       •   Directories with non-zero size field.  Size is set to zero.
37
38       •   Directory  . does not point to parent directory.  The start pointer
39           is adjusted.
40
41       •   Directory .. does not point to parent  of  parent  directory.   The
42           start pointer is adjusted.
43
44       •   .  and  ..  are  not the two first entries in a non-root directory.
45           The entries are created, moving occupied slots if necessary.
46
47       •   Start cluster number of a file is invalid.  The file is truncated.
48
49       •   File contains bad or free clusters.  The file is truncated.
50
51       •   File's cluster chain is longer than indicated by the  size  fields.
52           The file is truncated.
53
54       •   Two  or  more  files share the same cluster(s).  All but one of the
55           files are truncated.  If the file being truncated  is  a  directory
56           file  that has already been read, the filesystem check is restarted
57           after truncation.
58
59       •   File's cluster chain is shorter than indicated by the size  fields.
60           The file is truncated.
61
62       •   Volume  label in root directory or label in boot sector is invalid.
63           Invalid labels are removed.
64
65       •   Volume label in root directory and label in boot sector are differ‐
66           ent.  Volume label from root directory is copied to boot sector.
67
68       •   Clusters  are marked as used but are not owned by a file.  They are
69           marked as free.
70
71       Additionally, the following problems are detected, but not repaired:
72
73       •   Invalid parameters in boot sector
74
75       When fsck.fat checks a filesystem, it accumulates all changes in memory
76       and performs them only after all checks are complete.  This can be dis‐
77       abled with the -w option.
78
79       Two different variants of the FAT filesystem are  supported.   Standard
80       is  the  FAT12, FAT16 and FAT32 filesystems as defined by Microsoft and
81       widely used on hard disks and removable media like USB  sticks  and  SD
82       cards.  The other is the legacy Atari variant used on Atari ST.
83
84       There  are  some  minor  differences  in Atari format: Some boot sector
85       fields are interpreted slightly different, and the special FAT  entries
86       for  end-of-file and bad cluster can be different.  Under MS-DOS 0xfff8
87       is used for EOF and Atari employs 0xffff by default, but  both  systems
88       recognize  all  values  from 0xfff8–0xffff as end-of-file.  MS-DOS uses
89       only 0xfff7 for bad clusters, where on Atari values  0xfff0–0xfff7  are
90       for this purpose (but the standard value is still 0xfff7).
91

OPTIONS

93       -a  Automatically  repair the filesystem.  No user intervention is nec‐
94           essary.  Whenever there is more than one method to solve a problem,
95           the least destructive approach is used.
96
97       -A  Select  using  the  Atari  variation  of the FAT filesystem if that
98           isn't active already, otherwise  select  standard  FAT  filesystem.
99           This is selected by default if mkfs.fat is run on 68k Atari Linux.
100
101       -b  Make read-only boot sector check.
102
103       -c PAGE
104           Use DOS codepage PAGE to decode short file names.  By default code‐
105           page 850 is used.
106
107       -d PATH
108           Delete the specified file.  If more than one file  with  that  name
109           exist,  the  first  one  is deleted.  This option can be given more
110           than once.
111
112       -f  Salvage unused cluster chains to files.  By default,  unused  clus‐
113           ters are added to the free disk space except in auto mode (-a).
114
115       -F NUM
116           Specify FAT table NUM for filesystem access.  By default value 0 is
117           assumed and then the first uncorrupted FAT table is chosen.  Uncor‐
118           rupted  means  that  FAT table has valid first cluster.  If default
119           value 0 is used and all FAT  tables  are  corrupted  then  fsck.fat
120           gives  up  and  does not try to repair FAT filesystem.  If non-zero
121           NUM value is specified then fsck.fat uses FAT table NUM for repair‐
122           ing  FAT  filesystem.  If FAT table NUM has corrupted first cluster
123           then fsck.fat will repair it.  In any case, if FAT  filesystem  has
124           more FAT tables then repaired content of chosen FAT table is copied
125           to other FAT tables.  To repair corrupted first cluster it  is  re‐
126           quired to call fsck.fat with non-zero NUM value.
127
128       -l  List path names of files being processed.
129
130       -n  No-operation  mode:  non-interactively  check for errors, but don't
131           write anything to the filesystem.
132
133       -p  Same as -a, for compatibility with other *fsck.
134
135       -r  Interactively repair the filesystem.  The user is asked for  advice
136           whenever  there  is more than one approach to fix an inconsistency.
137           This is the default mode and the option is only retained for  back‐
138           wards compatibility.
139
140       -S  Consider short (8.3) file names with spaces in the middle to be in‐
141           valid, like previous versions of this program did.  While such file
142           names  are  not  forbidden by the FAT specification, and were never
143           treated as errors by Microsoft file system checking tools, many DOS
144           programs  are  unable  to handle files with such names.  Using this
145           option can make them accessible to these programs.
146
147           Short file names which start with a space  are  considered  invalid
148           regardless of this option's setting.
149
150           Previous versions of this program exceptionally treated EA DATA. SF
151           and WP ROOT. SF as valid short names; using this  option  does  not
152           preserve that exception.
153
154       -t  Mark unreadable clusters as bad.
155
156       -u PATH
157           Try  to  undelete the specified file.  fsck.fat tries to allocate a
158           chain of contiguous unallocated clusters beginning with  the  start
159           cluster  of the undeleted file.  This option can be given more than
160           once.
161
162       -U  Consider lowercase volume and boot label as invalid and allow  only
163           uppercase  characters.  Such labels are forbidden by the FAT speci‐
164           fication, but they are widely used by Linux tools.  Moreover MS-DOS
165           and  Windows  systems do not have problems to read them.  Therefore
166           volume and boot labels with lowercase  characters  are  by  default
167           permitted.
168
169       -v  Verbose mode.  Generates slightly more output.
170
171       -V  Perform  a verification pass.  The filesystem check is repeated af‐
172           ter the first run.  The second pass should never report any fixable
173           errors.   It  may take considerably longer than the first pass, be‐
174           cause the first pass may have generated long list of  modifications
175           that have to be scanned for each disk read.
176
177       --variant TYPE
178           Create  a  filesystem of variant TYPE.  Acceptable values are stan‐
179           dard and atari (in any combination of upper/lower case).  See above
180           under DESCRIPTION for the differences.
181
182       -w  Write changes to disk immediately.
183
184       -y  Same as -a (automatically repair filesystem) for compatibility with
185           other fsck tools.
186
187       --help
188           Display help message describing usage and options then exit.
189

EXIT STATUS

191       0   No recoverable errors have been detected.
192
193       1   Recoverable errors have been detected or fsck.fat has discovered an
194           internal inconsistency.
195
196       2   Usage error.  fsck.fat did not access the filesystem.
197

FILES

199       fsck0000.rec, fsck0001.rec, ...
200           When  recovering from a corrupted filesystem, fsck.fat dumps recov‐
201           ered data into files named fsckNNNN.rec in the top level  directory
202           of the filesystem.
203

BUGS

205       •   Does not remove entirely empty directories.
206
207       •   Should give more diagnostic messages.
208
209       •   Undeleting files should use a more sophisticated algorithm.
210

SEE ALSO

212       fatlabel(8), mkfs.fat(8)
213

HOMEPAGE

215       The  home  for  the  dosfstools  project  is  its  GitHub  project page
216https://github.com/dosfstools/dosfstools⟩.
217

AUTHORS

219       dosfstools were  written  by  Werner  Almesberger  ⟨werner.almesberger@
220       lrc.di.epfl.ch⟩,  Roman Hodek ⟨Roman.Hodek@informatik.uni-erlangen.de⟩,
221       and others.  Current maintainers are Andreas Bombe ⟨aeb@debian.org⟩ and
222       Pali Rohár ⟨pali.rohar@gmail.com⟩.
223
224
225
226dosfstools 4.2                    2021-01-31                       FSCK.FAT(8)
Impressum