FSCK(8) FSCK(8) NAME fsck - file system consistency check and interactive repair SYNOPSIS /etc/fsck -p [ special ... ] /etc/fsck [ -y ] [ -n ] [ -sX ] [ -SX ] [ -t filename ] [ special ... ] DESCRIPTION Fsck inspects the disk filesystems in the named special files and repairs inconsistencies. If no files are named, every file system listed in fstab(5) with type 0 and a nonzero pass number is checked. Under option -p, fsck runs without intervention, repairing minor inconsistencies and aborting on major ones. This form is usually called from rc(8). If no special files are named, file systems in fstab are checked in parallel passes: all file systems with pass number 1 are checked simultaneously, then all file systems with pass number 2, and so on until fstab is exhausted. Here are the minor ailments repaired automatically under -p: unreferenced inodes; wrong link counts in inodes; missing blocks in the free list; blocks in the free list also in files; and counts wrong in the super-block. Other inconsistencies cause fsck to abandon the inconsistent file system, and exit with a nonzero status when the current pass finishes. Without the -p option, fsck inspects one file system at a time, interactively. Each inconsistency causes fsck to print a message and ask permission to fix the problem. The operator may require arcane knowledge to guide fsck safely through repair of a badly damaged file system. Here are the remaining options. They are allowed only if -p is absent. -y Assume a yes response to all questions. This should be used with great caution. -n Assume a no response to all questions; do not open the file system for writing. This option is assumed if the file system cannot be opened for writing. -sX Ignore the actual free list and (unconditionally) FSCK(8) FSCK(8) 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 precaution is necessary so that the old, bad, in-core copy of the superblock will not continue to be used, or written on the file system. If the file system has a bitmap free list (see filsys(5)), the free list is always recon- structed unless the -n option is enabled. Parameter X allows free-list parameters to be speci- fied: -sblocks-per-cylinder:blocks-to-skip. If X is not given, the values used when the file system was created are used; see mkfs(8). If these values were not specified, X is assumed to be 400:9. -SX Conditionally reconstruct the free list. This option is like -sX except that the free list is rebuilt only if no discrepancies were found. -S implies -n. -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 -t, fsck will prompt the operator for the name of the scratch file. The file chosen should not be on the file system being checked. If it did not already exist, it is removed when fsck completes. Inconsistencies checked are: Blocks claimed more than once. Blocks designated outside the file system. Incorrect link counts. Directory size not 16-byte aligned. Bad inode format. Blocks not accounted for anywhere. Directory entry pointing to unallocated inode. Inode number out of range. More than 65536 inodes. More blocks for inodes than there are in the file system. Bad free block list format. Total free block and/or free inode count incorrect. Orphaned files and directories (allocated but unreferenced) are reconnected by placing them in the directory in the root of the file system being checked. The name assigned is the inode number, prefixed by `#'. Checking the raw device is almost always faster, but fsck distinguishes bitmapped from non-bitmapped file systems by FSCK(8) FSCK(8) examining the minor device number, so the block device is safer. FILES SEE ALSO fstab(5), filsys(5), mkfs(8), reboot(8) T. J. Kowalski, `Fsck-the UNIX File System Check Program', this manual, Volume 2 BUGS Inode numbers for . and .. in each directory should be checked for validity. Some systems save core images after a crash in the swap area; on such machines, checking many large file systems in parallel may cause swapping, overwriting the crash dump. It is best just to write crash dumps in a a safer place. If disk space for dumps and swapping is scarce, avoid checking more than three 120-megabyte file systems in parallel on a machine with four megabytes of physical memory. Examining the minor device number is a botch; there should be an explicit flag somewhere. Fsck does not have supernatural powers.