1FSCK.FAT(8)                       dosfstools                       FSCK.FAT(8)
2
3
4

NAME

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

SYNOPSIS

10       fsck.fat|fsck.msdos|fsck.vfat [-aAflnprtvVwy] [-d PATH -d ...] [-u PATH
11       -u ...] DEVICE
12
13

DESCRIPTION

15       fsck.fat verifies the consistency of MS-DOS filesystems and  optionally
16       tries to repair them.
17
18       The following filesystem problems can be corrected (in this order):
19
20       *   FAT contains invalid cluster numbers. Cluster is changed to EOF.
21
22       *   File's cluster chain contains a loop. The loop is broken.
23
24       *   Bad  clusters  (read  errors). The clusters are marked bad and they
25           are removed from files owning them. This check is optional.
26
27       *   Directories with a large number of bad entries (probably  corrupt).
28           The directory can be deleted.
29
30       *   Files . and .. are non-directories. They can be deleted or renamed.
31
32       *   Directories . and .. in root directory. They are deleted.
33
34       *   Bad filenames. They can be renamed.
35
36       *   Duplicate directory entries. They can be deleted or renamed.
37
38       *   Directories with non-zero size field. Size is set to zero.
39
40       *   Directory  .  does not point to parent directory. The start pointer
41           is adjusted.
42
43       *   Directory .. does not point to  parent  of  parent  directory.  The
44           start pointer is adjusted.
45
46       *   Start cluster number of a file is invalid. The file is truncated.
47
48       *   File contains bad or free clusters. The file is truncated.
49
50       *   File's  cluster  chain is longer than indicated by the size fields.
51           The file is truncated.
52
53       *   Two or more files share the same cluster(s). All  but  one  of  the
54           files  are  truncated.  If  the file being truncated is a directory
55           file that has already been read, the filesystem check is  restarted
56           after truncation.
57
58       *   File's  cluster chain is shorter than indicated by the size fields.
59           The file is truncated.
60
61       *   Clusters are marked as used but are not owned by a file.  They  are
62           marked as free.
63
64       Additionally, the following problems are detected, but not repaired:
65
66       *   Invalid parameters in boot sector.
67
68       *   Absence of . and .. entries in non-root directories
69
70       When fsck.fat checks a filesystem, it accumulates all changes in memory
71       and performs them only after all checks are complete. This can be  dis‐
72       abled with the -w option.
73
74

OPTIONS

76       -a  Automatically repair the filesystem. No user intervention is neces‐
77           sary. Whenever there is more than one method to  solve  a  problem,
78           the least destructive approach is used.
79
80       -A  Use  Atari  variation  of the MS-DOS filesystem. This is default if
81           fsck.fat is run on an Atari, then this option turns off Atari  for‐
82           mat.  There  are  some minor differences in Atari format: Some boot
83           sector fields are interpreted slightly different, and  the  special
84           FAT entries for end-of-file and bad cluster can be different. Under
85           MS-DOS 0xfff8 is used for EOF and Atari employs 0xffff by  default,
86           but  both  systems  recognize  all  values  from 0xfff8...0xffff as
87           end-of-file. MS-DOS uses only 0xfff7 for  bad  clusters,  where  on
88           Atari values 0xfff0...0xfff7 are for this purpose (but the standard
89           value is still 0xfff7).
90
91       -b  Make read-only boot sector check.
92
93       -d  Delete the specified file. If more that one  file  with  that  name
94           exists, the first one is deleted.
95
96       -f  Salvage unused cluster chains to files. By default, unused clusters
97           are added to the free disk space except in auto mode (-a).
98
99       -l  List path names of files being processed.
100
101       -n  No-operation mode: non-interactively check for  errors,  but  don't
102           write anything to the filesystem.
103
104       -p  Same as (-a), for compatibility with other *fsck.
105
106       -r  Interactively  repair  the filesystem. The user is asked for advice
107           whenever there is more than one approach to fix an inconsistency.
108
109       -t  Mark unreadable clusters as bad.
110
111       -u  Try to undelete the specified file. fsck.fat tries  to  allocate  a
112           chain  of  contiguous unallocated clusters beginning with the start
113           cluster of the undeleted file.
114
115       -v  Verbose mode. Generates slightly more output.
116
117       -V  Perform a verification pass. The filesystem check is repeated after
118           the  first  run.  The  second  pass should never report any fixable
119           errors. It may  take  considerably  longer  than  the  first  pass,
120           because  the  first  pass may have generated long list of modifica‐
121           tions that have to be scanned for each disk read.
122
123       -w  Write changes to disk immediately.
124
125       -y  Same as -a (automatically repair filesystem) for compatibility with
126           other fsck tools.
127
128       Note:  If -a and -r are absent, the filesystem is only checked, but not
129       repaired.
130
131

EXIT STATUS

133       0   No recoverable errors have been detected.
134
135       1   Recoverable errors have been detected or fsck.fat has discovered an
136           internal inconsistency.
137
138       2   Usage error. fsck.fat did not access the filesystem.
139
140

FILES

142       fsck0000.rec, fsck0001.rec, ...
143           When  recovering from a corrupted filesystem, fsck.fat dumps recov‐
144           ered data into files named 'fsckNNNN.rec' in the top  level  direc‐
145           tory of the filesystem.
146
147

BUGS

149       Does  not  create  .  and  ..  files  where  necessary. Does not remove
150       entirely empty  directories.  Should  give  more  diagnostic  messages.
151       Undeleting files should use a more sophisticated algorithm.
152
153

SEE ALSO

155       fatlabel(8)
156       mkfs.fat(8)
157
158

HOMEPAGE

160       More  information  about  fsck.fat  and  dosfstools  can  be  found  at
161       <http://daniel-baumann.ch/software/dosfstools/>.
162
163

AUTHORS

165       dosfstools  were   written   by   Werner   Almesberger   <werner.almes‐
166       berger@lrc.di.epfl.ch>,  Roman Hodek <Roman.Hodek@informatik.uni-erlan‐
167       gen.de>,  and  others.  The  current  maintainer  is   Daniel   Baumann
168       <mail@daniel-baumann.ch>.
169
170
171
1723.0.19                            2013-06-11                       FSCK.FAT(8)
Impressum