FSCK(1M) INTERACTIVE UNIX System FSCK(1M)
NAME
fsck, dfsck - check and repair file systems
SYNOPSIS
/etc/fsck [-y] [-n] [-sX] [-SX] [-t file] [-q] [-D] [-f]
[-b] [file-systems]
/etc/dfsck [options1] fsys1 ... - [options2] fsys2 ...
DESCRIPTION
fsck
The fsck command audits and interactively repairs incon-
sistent conditions for file systems. If the file system is
found to be consistent, the number of files, blocks used,
and blocks free are reported. If the file system is incon-
sistent, the user is prompted for concurrence before each
correction is attempted. It should be noted that most
corrective actions will result in some loss of data. The
amount and severity of data loss may be determined from the
diagnostic output. The default action for each correction
is to wait for the user to respond yes or no. If the user
does not have write permission, fsck defaults to a -n
action.
The following options are accepted by fsck:
-y Assume a yes response to all questions asked by fsck.
-n Assume a no response to all questions asked by fsck;
do not open the file system for writing.
-sX Ignore the actual free list and (unconditionally)
reconstruct a new one by rewriting the super block of
the file system. The file system should be unmounted
while this is done; if this is not possible, care
should be taken that the system is quiescent and that
it is rebooted immediately afterwards. This precau-
tion is necessary so that the old, bad, in-core copy
of the super block will not continue to be used, or
written on the file system.
The -sX option allows for creating an optimal free-
list organization.
If X is not given, the values used when the file sys-
tem was created are used. The format of X is cylinder
size:gap size.
-SX Conditionally reconstruct the free list. This option
is like -sX above except that the free list is rebuilt
only if there were no discrepancies discovered in the
file system. Using -S will force a no response to all
questions asked by fsck. This option is useful for
forcing free list reorganization on uncontaminated
Rev. Base System Page 1
FSCK(1M) INTERACTIVE UNIX System FSCK(1M)
file systems.
-t If fsck cannot obtain enough memory to keep its
tables, it uses a scratch file. If the -t option is
specified, the file named in the next argument is used
as the scratch file, if needed. Without the -t flag,
fsck will prompt the user for the name of the scratch
file. The file chosen should not be on the file system
being checked, and if it is not a special file or did
not already exist, it is removed when fsck completes.
-q Quiet fsck. Do not print size-check messages.
Unreferenced fifos will silently be removed. If fsck
requires it, counts in the super block will be
automatically fixed and the free list salvaged.
-D Directories are checked for bad blocks. Useful after
system crashes.
-f Fast check. Check block and sizes and check the free
list. The free list will be reconstructed, if neces-
sary.
-b Reboot. If the file system being checked is the root
file system and modifications have been made, then
either remount the root file system or reboot the sys-
tem. A remount is done only if there was minor dam-
age.
If no file-systems are specified, fsck will read a list of
default file systems from the file /etc/checklist.
Inconsistencies checked are as follows:
1. Blocks claimed by more than one inode or the free
list.
2. Blocks claimed by an inode or the free list out-
side the range of the file system.
3. Incorrect link counts.
4. Size checks:
Incorrect number of blocks.
Directory size not 16-byte aligned.
5. Bad inode format.
6. Blocks not accounted for anywhere.
7. Directory checks:
File pointing to unallocated inode.
Inode number out of range.
8. Super Block checks:
More than 65536 inodes.
More blocks for inodes than there are in
the file system.
9. Bad free block list format.
10. Total free block and/or free inode count
Rev. Base System Page 2
FSCK(1M) INTERACTIVE UNIX System FSCK(1M)
incorrect.
Orphaned files and directories (allocated but unreferenced)
are, with the user's concurrence, reconnected by placing
them in the lost+found directory, if the files are nonempty.
The user will be notified if the file or directory is empty
or not. Empty files or directories are removed, as long as
the -n option is not specified. fsck will force the recon-
nection of nonempty directories. The name assigned is the
inode number. The only restriction is that the directory
lost+found must preexist in the root of the file system
being checked and must have empty slots in which entries can
be made. This is accomplished by making lost+found, copying
a number of files to the directory, and then removing them
(before fsck is executed).
Checking the raw device is almost always faster and should
be used with everything but the root file system.
dfsck
The dfsck command allows two file system checks on two dif-
ferent drives simultaneously. options1 and options2 are
used to pass options to fsck for the two sets of file sys-
tems. A - is the separator between the file system groups.
The dfsck command permits a user to interact with two fsck
programs at once. To aid in this, dfsck will print the file
system name for each message to the user. When answering a
question from dfsck, the user must prefix the response with
a 1 or a 2 (indicating that the answer refers to the first
or second file system group).
FILES
/etc/checklist contains default list of file systems
to check.
SEE ALSO
crash(1M), mkfs(1M), ncheck(1M), xfsck(1M).
uadmin(2), checklist(4), fs(4) in the INTERACTIVE SDS Guide
and Programmer's Reference Manual.
BUGS
Inode numbers for . and .. in each directory are not checked
for validity.
Rev. Base System Page 3