Imported Upstream version 4.2
[platform/upstream/dosfstools.git] / manpages / fsck.fat.8.in
1 .\" fsck.fat.8 - manpage for fsck.fat
2 .\"
3 .\" Copyright (C) 2006-2014 Daniel Baumann <daniel@debian.org>
4 .\" Copyright (C) 2018-2021 Pali Rohár <pali.rohar@gmail.com>
5 .\"
6 .\" This program is free software: you can redistribute it and/or modify
7 .\" it under the terms of the GNU General Public License as published by
8 .\" the Free Software Foundation, either version 3 of the License, or
9 .\" (at your option) any later version.
10 .\"
11 .\" This program is distributed in the hope that it will be useful,
12 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
13 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 .\" GNU General Public License for more details.
15 .\"
16 .\" You should have received a copy of the GNU General Public License
17 .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
18 .\"
19 .\" The complete text of the GNU General Public License
20 .\" can be found in /usr/share/common-licenses/GPL-3 file.
21 .\"
22 .\"
23 .TH FSCK.FAT 8 @RELEASE_DATE@ "dosfstools @PACKAGE_VERSION@"
24 .SH NAME
25 fsck.fat \- check and repair MS-DOS FAT filesystems
26 .\" ----------------------------------------------------------------------------
27 .SH SYNOPSIS
28 \fBfsck.fat\fP [\fIOPTIONS\fP] \fIDEVICE\fP
29 .\" ----------------------------------------------------------------------------
30 .SH DESCRIPTION
31 \fBfsck.fat\fP verifies the consistency of MS-DOS filesystems and optionally
32 tries to repair them.
33 .PP
34 The following filesystem problems can be corrected (in this order):
35 .IP "\(bu" 4
36 FAT contains invalid cluster numbers.
37 Cluster is changed to EOF.
38 .IP "\(bu" 4
39 File's cluster chain contains a loop.
40 The loop is broken.
41 .IP "\(bu" 4
42 Bad clusters (read errors).
43 The clusters are marked bad and they are removed from files owning them.
44 This check is optional.
45 .IP "\(bu" 4
46 Directories with a large number of bad entries (probably corrupt).
47 The directory can be deleted.
48 .IP "\(bu" 4
49 Files . and .. are non-directories.
50 They can be deleted or renamed.
51 .IP "\(bu" 4
52 Directories . and .. in root directory.
53 They are deleted.
54 .IP "\(bu" 4
55 Bad filenames.
56 They can be renamed.
57 .IP "\(bu" 4
58 Duplicate directory entries.
59 They can be deleted or renamed.
60 .IP "\(bu" 4
61 Directories with non-zero size field.
62 Size is set to zero.
63 .IP "\(bu" 4
64 Directory . does not point to parent directory.
65 The start pointer is adjusted.
66 .IP "\(bu" 4
67 Directory .. does not point to parent of parent directory.
68 The start pointer is adjusted.
69 .IP "\(bu" 4
70 \&. and .. are not the two first entries in a non-root directory.
71 The entries are created, moving occupied slots if necessary.
72 .IP "\(bu" 4
73 Start cluster number of a file is invalid.
74 The file is truncated.
75 .IP "\(bu" 4
76 File contains bad or free clusters.
77 The file is truncated.
78 .IP "\(bu" 4
79 File's cluster chain is longer than indicated by the size fields.
80 The file is truncated.
81 .IP "\(bu" 4
82 Two or more files share the same cluster(s).
83 All but one of the files are truncated.
84 If the file being truncated is a directory file that has already been read, the
85 filesystem check is restarted after truncation.
86 .IP "\(bu" 4
87 File's cluster chain is shorter than indicated by the size fields.
88 The file is truncated.
89 .IP "\(bu" 4
90 Volume label in root directory or label in boot sector is invalid.
91 Invalid labels are removed.
92 .IP "\(bu" 4
93 Volume label in root directory and label in boot sector are different.
94 Volume label from root directory is copied to boot sector.
95 .IP "\(bu" 4
96 Clusters are marked as used but are not owned by a file.
97 They are marked as free.
98 .PP
99 Additionally, the following problems are detected, but not repaired:
100 .IP "\(bu" 4
101 Invalid parameters in boot sector
102 .PP
103 When \fBfsck.fat\fP checks a filesystem, it accumulates all changes in memory
104 and performs them only after all checks are complete.
105 This can be disabled with the \fB\-w\fP option.
106 .PP
107 Two different variants of the FAT filesystem are supported.
108 Standard is the FAT12, FAT16 and FAT32 filesystems as defined by Microsoft and
109 widely used on hard disks and removable media like USB sticks and SD cards.
110 The other is the legacy Atari variant used on Atari ST.
111 .PP
112 There are some minor differences in Atari format:
113 Some boot sector fields are interpreted slightly different, and the special FAT
114 entries for end-of-file and bad cluster can be different.
115 Under MS-DOS 0xfff8 is used for EOF and Atari employs 0xffff by default, but
116 both systems recognize all values from 0xfff8\(en0xffff as end-of-file.
117 MS-DOS uses only 0xfff7 for bad clusters, where on Atari values 0xfff0\(en0xfff7
118 are for this purpose (but the standard value is still 0xfff7).
119 .\" ----------------------------------------------------------------------------
120 .SH OPTIONS
121 .IP "\fB\-a\fP" 4
122 Automatically repair the filesystem.
123 No user intervention is necessary.
124 Whenever there is more than one method to solve a problem, the least
125 destructive approach is used.
126 .IP "\fB\-A\fP" 4
127 Select using the Atari variation of the FAT filesystem if that isn't active
128 already, otherwise select standard FAT filesystem.
129 This is selected by default if \fBmkfs.fat\fP is run on 68k Atari Linux.
130 .IP "\fB-b\fP" 4
131 Make read-only boot sector check.
132 .IP "\fB-c\fP \fIPAGE\fP" 4
133 Use DOS codepage \fIPAGE\fP to decode short file names.
134 By default codepage 850 is used.
135 .IP "\fB\-d\fP \fIPATH\fP" 4
136 Delete the specified file.
137 If more than one file with that name exist, the first one is deleted.
138 This option can be given more than once.
139 .IP "\fB\-f\fP" 4
140 Salvage unused cluster chains to files.
141 By default, unused clusters are added to the free disk space except in auto mode
142 (\fB\-a\fP).
143 .IP "\fB\-F\fP \fINUM\fP" 4
144 Specify FAT table \fINUM\fP for filesystem access.
145 By default value \fI0\fP is assumed and then the first uncorrupted FAT table is
146 chosen.
147 Uncorrupted means that FAT table has valid first cluster.
148 If default value \fI0\fP is used and all FAT tables are corrupted then
149 \fBfsck.fat\fP gives up and does not try to repair FAT filesystem.
150 If non-zero \fINUM\fP value is specified then \fBfsck.fat\fP uses FAT table
151 \fINUM\fP for repairing FAT filesystem.
152 If FAT table \fINUM\fP has corrupted first cluster then \fBfsck.fat\fP will
153 repair it.
154 In any case, if FAT filesystem has more FAT tables then repaired content of
155 chosen FAT table is copied to other FAT tables.
156 To repair corrupted first cluster it is required to call \fBfsck.fat\fP with
157 non-zero \fINUM\fP value.
158 .IP "\fB\-l\fP" 4
159 List path names of files being processed.
160 .IP "\fB\-n\fP" 4
161 No-operation mode: non-interactively check for errors, but don't write
162 anything to the filesystem.
163 .IP "\fB\-p\fP" 4
164 Same as \fB\-a\fP, for compatibility with other *fsck.
165 .IP "\fB\-r\fP" 4
166 Interactively repair the filesystem.
167 The user is asked for advice whenever there is more than one approach to fix an
168 inconsistency.
169 This is the default mode and the option is only retained for backwards
170 compatibility.
171 .IP "\fB\-S\fP" 4
172 Consider short (8.3) file names with spaces in the middle to be invalid, like
173 previous versions of this program did.
174 While such file names are not forbidden by the FAT specification, and were never
175 treated as errors by Microsoft file system checking tools, many DOS programs are
176 unable to handle files with such names.
177 Using this option can make them accessible to these programs.
178 .IP "" 4
179 Short file names which \fIstart\fP with a space are considered invalid
180 regardless of this option's setting.
181 .IP "" 4
182 Previous versions of this program exceptionally treated \fIEA DATA. SF\fP and
183 \fIWP ROOT. SF\fP as valid short names; using this option does not preserve
184 that exception.
185 .IP "\fB\-t\fP" 4
186 Mark unreadable clusters as bad.
187 .IP "\fB\-u\fP \fIPATH\fP" 4
188 Try to undelete the specified file.
189 \fBfsck.fat\fP tries to allocate a chain of contiguous unallocated clusters
190 beginning with the start cluster of the undeleted file.
191 This option can be given more than once.
192 .IP "\fB\-U\fP" 4
193 Consider lowercase volume and boot label as invalid and allow only uppercase
194 characters.
195 Such labels are forbidden by the FAT specification, but they are widely used
196 by Linux tools.
197 Moreover MS-DOS and Windows systems do not have problems to read them.
198 Therefore volume and boot labels with lowercase characters are by default
199 permitted.
200 .IP "\fB\-v\fP" 4
201 Verbose mode.
202 Generates slightly more output.
203 .IP "\fB\-V\fP" 4
204 Perform a verification pass.
205 The filesystem check is repeated after the first run.
206 The second pass should never report any fixable errors.
207 It may take considerably longer than the first pass, because the first pass may
208 have generated long list of modifications that have to be scanned for each disk
209 read.
210 .IP "\fB\-\-variant\fP \fITYPE\fP" 4
211 Create a filesystem of variant \fITYPE\fP.
212 Acceptable values are \fIstandard\fP and \fIatari\fP (in any combination of
213 upper/lower case).
214 See above under DESCRIPTION for the differences.
215 .IP "\fB\-w\fP" 4
216 Write changes to disk immediately.
217 .IP "\fB\-y\fP" 4
218 Same as \fB\-a\fP (automatically repair filesystem) for compatibility with other
219 fsck tools.
220 .IP "\fB\-\-help\fP" 4
221 Display help message describing usage and options then exit.
222 .\" ----------------------------------------------------------------------------
223 .SH "EXIT STATUS"
224 .IP "0" 4
225 No recoverable errors have been detected.
226 .IP "1" 4
227 Recoverable errors have been detected or \fBfsck.fat\fP has discovered an
228 internal inconsistency.
229 .IP "2" 4
230 Usage error.
231 \fBfsck.fat\fP did not access the filesystem.
232 .\" ----------------------------------------------------------------------------
233 .SH FILES
234 .IP "\fIfsck0000.rec\fP, \fIfsck0001.rec\fP, ..." 4
235 When recovering from a corrupted filesystem, \fBfsck.fat\fP dumps recovered data
236 into files named \fIfsckNNNN.rec\fP in the top level directory of the filesystem.
237 .\" ----------------------------------------------------------------------------
238 .SH BUGS
239 .IP "\(bu" 4
240 Does not remove entirely empty directories.
241 .IP "\(bu" 4
242 Should give more diagnostic messages.
243 .IP "\(bu" 4
244 Undeleting files should use a more sophisticated algorithm.
245 .\" ----------------------------------------------------------------------------
246 .SH SEE ALSO
247 .BR fatlabel (8),
248 .BR mkfs.fat (8)
249 .\" ----------------------------------------------------------------------------
250 .SH HOMEPAGE
251 The home for the \fBdosfstools\fP project is its
252 .UR https://github.com/dosfstools/dosfstools
253 GitHub project page
254 .UE .
255 .\" ----------------------------------------------------------------------------
256 .SH AUTHORS
257 \fBdosfstools\fP were written by
258 .MT werner.almesberger@\:lrc.di.epfl.ch
259 Werner Almesberger
260 .ME ,
261 .MT Roman.Hodek@\:informatik.\:uni-erlangen.de
262 Roman Hodek
263 .ME ,
264 and others.
265 Current maintainers are
266 .MT aeb@\:debian.org
267 Andreas Bombe
268 .ME
269 and
270 .MT pali.rohar@\:gmail.com
271 Pali Rohár
272 .ME .