fsck(1M) fsck(1M)
fsck - check and repair filesystems for EFS
/etc/fsck [-c] [-f] [-g] [-m] [-n] [-q] [-y] [-l dir] [filesystems]
fsck is applicable only to EFS filesystems. To repair XFS filesystems,
see xfs_repair(1M).
fsck audits and repairs inconsistent conditions for filesystems. You
must have both read and write permission for the device containing the
filesystem unless you give the -n flag, in which case only read
permission is required.
If the filesystem is inconsistent, you are normally prompted for
concurrence before each correction is attempted. Most corrective actions
result in some loss of data. The amount and severity of data loss can be
determined from the diagnostic output. The default action for each
correction is to wait for you to respond yes or no. However, certain
option flags cause fsck to run in a non-interactive mode.
On completion, the number of files, blocks used, and blocks free are
reported.
Note: Checking the raw device is almost always faster.
The following options are accepted by fsck:
-c Checks the filesystem only if the superblock indicates that it is
dirty, otherwise a message is printed saying that the filesystem is
clean and no check is performed. The default in the absence of
this option is to always perform the check.
-f Fast check. Check block and sizes and check the free list. The
free list is reconstructed if it is necessary. No directory or
pathname checks are performed.
-g A low risk "gentle" mode, similar to BSD preen. Problems that do
not present any risk of data loss are fixed: these include bad link
counts, bad free list, and dirty superblock. If any serious damage
is encountered that cannot be repaired without risk of data loss,
fsck terminates with a warning message.
-l Allows a directory on a mounted filesystem, located elsewhere on
the system, to be specified as a salvage directory. Unreferenced
regular files, named after their inode numbers, are copied into
this salvage directory. This allows files to be salvaged from very
badly corrupted filesystems that may not be repairable in place --
if the root inode is lost, for example.
Page 1
fsck(1M) fsck(1M)
-m Forks multiple instances of fsck to check filesystems in parallel
for improved speed. This option is effective only when fsck is
working from the filesystems listed in /etc/fstab and is ignored if
explicit filesystem arguments are given. Also, when this option is
specified, entries in /etc/fstab with the noauto option are
ignored.
-n Assumes a no response to all questions asked by fsck; does not open
the filesystem for writing.
-q Quiet fsck. This option is effectively a version of the -y option
with less verbose output.
-y Assumes a yes response to all questions asked by fsck.
If no filesystems are specified, fsck reads a list of default filesystems
from the file /etc/fstab. This does not include the root filesystem;
fsck runs on root only if this is explicitly specified.
Normally, a filesystem must be unmounted in order to run fsck on it, an
error message is printed and no action taken if invoked on a mounted
filesystem. The one exception to this is the root filesystem, which must
be mounted to run fsck. If inconsistencies are detected when running on
root, fsck causes a remount of root.
When invoked with the -m flag and without explicit filesystem parameters,
fsck scans /etc/fstab and attempts to fork a check process for each efs
filesystem found. These checks proceed in parallel, for improved speed.
The name of the device holding the filesystem is printed as each check
begins. However, to avoid confusion, the remaining output from these
parallel checks is not printed; instead it is placed in log files in the
directory /etc/fscklogs. This directory is created if it does not
currently exist.
The log files are named after the last component of the pathname of the
device where the filesystem resides. For example, if a filesystem was on
/dev/dsk/ips0d1s7 the logfile is named /etc/fscklogs/ips0d1s7.
Because there is no interaction with the checks, the -m option is
accepted only in combination with another option implying non interactive
behavior: -y or -g.
As each check completes, the name of the device is printed along with a
message indicating success or failure. In the event of failure, the name
of the logfile containing the output from the check of that filesystem is
also printed.
Some control over the parallelization is possible by placing passnumbers
in /etc/fstab (see fstab(4)). If pass numbers are given for filesystems,
they are checked in the order of their pass numbers. All filesystems
Page 2
fsck(1M) fsck(1M)
with a given pass number are checked (in parallel, if more than one
filesystem has the same pass number) before the next highest pass number.
A missing pass number defaults to zero. If no pass numbers are present,
all filesystems are checked simultaneously if possible.
Note: In fact, fsck takes note of the amount of memory available in the
system, and limits the number of simultaneous check processes to avoid
swapping. If there is not enough memory to avoid swapping for a
particular filesystem, the message
Warning - Low free memory, swapping likely
is printed. If this occurs when fsck'ing the root or usr filesystem
after a crash, the crash dump is lost. In this case the fsck takes
longer, but the results are otherwise normal.
Inconsistencies checked are as follows:
1. Inode block addressing checks: Too many direct or indirect
extents, extents out of order, bad magic number in extents, blocks
that are not in a legal data area of the filesystem, blocks that
are claimed by more than one inode.
2. Size checks: Number of blocks claimed by inode inconsistent with
inode size, directory size not block aligned.
3. Directory checks: Illegal number of entries in a directory block,
bad freespace pointer in directory block, entry pointing to
unallocated or outrange inode, overlapping entries, missing or
incorrect dot and dotdot entries.
4. Pathname checks: Files or directories not referenced by a pathname
starting from the filesystem root.
5. Link count checks: Link counts that do not agree with the number
of directory references to the inode.
6. Freemap checks: Blocks claimed free by the freemap but also
claimed by an inode, blocks unclaimed by any inode but not
appearing in the freemap.
7. Super Block checks: Total free block and/or free i-node count
incorrect.
Orphaned files and directories (allocated but unreferenced) are, with the
your concurrence, reconnected by placing them in the lost+found
directory, if the files are nonempty. You are 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 forces the reconnection of
nonempty directories. The name assigned is the i-node number. The
directory lost+found must preexist in the root of the filesystem being
Page 3
fsck(1M) fsck(1M)
checked and must have empty slots in which entries can be made. This
directory is always created by mkfs(1M) when a filesystem is first
created.
SUPERBLOCKS AND FILESYSTEM ROBUSTNESS
In IRIX 3.3 and later, a replicated superblock exists in the EFS
filesystem, situated at the end of the filesystem space. If fsck cannot
read the primary superblock it attempts to use the replicated superblock.
It prints a message to notify you of the situation. This is automatic;
no user intervention is required. Further, fsck attempts to determine if
a replicated superblock exists, and if not, optionally creates one.
Thus, older filesystems benefit from this feature.
Finally, if no superblock can be found on a damaged filesystem, it may be
possible to regenerate one by using the new -r option of mkfs(1M), and
then use fsck to salvage the filesystem.
Warning: This is not effective if the filesystem was created under a
version of IRIX other than the currently running version, since mkfs
defaults have changed from release to release.
The options -b, -D, -s, -S, and -t, which were supported by earlier
versions of fsck, are now obsolete.
The -b option caused a reboot of the system when fsck was run on the root
filesystem and errors were detected. The behavior now is always to
remount the root filesystem in this case.
The -t option specified a scratch file for temporary storage; this is now
never required.
The -D option added extra directory checks; these are now always done by
default.
The -s and -S options caused conditional or forced rebuild of the
freelist. The freelist is now exhaustively checked and is always rebuilt
if necessary.
All of these options are now legal no-ops.
/etc/fstab default list of filesystems to check
findblk(1M), fpck(1M), mkfs(1M), ncheck(1M), uadmin(2), filesystems(4),
fstab(4).
PPPPaaaaggggeeee 4444 [ Back ]
|