1DOSFSCK(8)                   MAINTENANCE COMMANDS                   DOSFSCK(8)
2
3
4

NAME

6       dosfsck - check and repair MS-DOS file systems
7

SYNOPSIS

9       dosfsck|fsck.msdos|fsck.vfat [-aAflnrtvVwy] [-d path -d ...]
10       [-u path -u ...]  device
11

DESCRIPTION

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

OPTIONS

57       -a     Automatically repair the file system. No  user  intervention  is
58              necessary.   Whenever  there  is more than one method to solve a
59              problem, the least destructive approach is used.
60
61       -A     Use Atari variation of the MS-DOS filesystem. This is default if
62              dosfsck  is  run  on  an Atari, then this option turns off Atari
63              format. There are some minor differences in Atari  format:  Some
64              boot  sector  fields are interpreted slightly different, and the
65              special FAT entries for end-of-file and bad cluster can be  dif‐
66              ferent.  Under  MS-DOS  0xfff8 is used for EOF and Atari employs
67              0xffff by default, but both systems recognize  all  values  from
68              0xfff8...0xffff as end-of-file.  MS-DOS uses only 0xfff7 for bad
69              clusters, where on Atari values  0xfff0...0xfff7  are  for  this
70              purpose (but the standard value is still 0xfff7).
71
72       -d     Delete  the specified file. If more that one file with that name
73              exists, the first one is deleted.
74
75       -f     Salvage unused cluster chains to files. By default, unused clus‐
76              ters are added to the free disk space except in auto mode (-a).
77
78       -l     List path names of files being processed.
79
80       -n     No-operation mode: non-interactively check for errors, but don't
81              write anything to the filesystem.
82
83       -r     Interactively repair the file system.  The  user  is  asked  for
84              advice whenever there is more than one approach to fix an incon‐
85              sistency.
86
87       -t     Mark unreadable clusters as bad.
88
89       -u     Try to undelete the specified file. dosfsck tries to allocate  a
90              chain  of  contiguous  unallocated  clusters  beginning with the
91              start cluster of the undeleted file.
92
93       -v     Verbose mode. Generates slightly more output.
94
95       -V     Perform a verification pass. The file system check  is  repeated
96              after  the  first  run.  The second pass should never report any
97              fixable errors. It may take considerably longer than  the  first
98              pass,  because  the  first  pass may have generated long list of
99              modifications that have to be scanned for each disk read.
100
101       -w     Write changes to disk immediately.
102
103       -y     Same as -a (automatically repair filesystem)  for  compatibility
104              with other fsck tools.
105
106       If  -a  and  -r  are  absent,  the file system is only checked, but not
107       repaired.
108

EXIT STATUS

110       0      No recoverable errors have been detected.
111
112       1      Recoverable errors have been detected or dosfsck has  discovered
113              an internal inconsistency.
114
115       2      Usage error. dosfsck did not access the file system.
116

FILES

118       fsck0000.rec, fsck0001.rec, ...
119              When  recovering  from  a  corrupted  file system, dosfsck dumps
120              recovered data into files named 'fsckNNNN.rec' in the top  level
121              directory of the file system.
122

BUGS

124       Does  not  create  .  and  ..  files  where  necessary. Does not remove
125       entirely empty  directories.  Should  give  more  diagnostic  messages.
126       Undeleting files should use a more sophisticated algorithm.
127

AUTHORS

129       Werner   Almesberger   <werner.almesberger@lrc.di.epfl.ch>   Extensions
130       (FAT32, VFAT) by and current maintainer: Roman Hodek <roman@hodek.net>
131
132
133
134Linux                          December 31 1997                     DOSFSCK(8)
Impressum