fsck checks file systems for inconsistencies and corrects these interactively with the user. The user’s agreement is requested before any corrective measures are implemented. Any inconsistencies other than those mentioned above may result in data loss. Diagnostic messages provide information about the extent and seriousness of such losses.
fsck automatically corrects less serious inconsistencies such as unreferenced inodes, excessive reference counter values in inodes, missing blocks in the free blocks list, blocks which simultaneously appear in the free blocks list and in files or incorrect superblock counters. A message is output for each inconsistency which is corrected. This message displays the type of correction and the file system in which it was performed. After the file system has been corrected, fsck outputs the number of files in the file system, the number of occupied and free blocks and the corresponding percentage values.
By default, the command waits for the user’s response, which must be either yes or no, before performing any correction. If the user does not possess write permission for the file system then fsck defaults to -n (no correction).
The command checks for the following inconsistencies:
Blocks claimed by multiple inodes or the free block list.
Blocks which are claimed by multiple inodes or the free block lits and which lie outside the file system.
Incorrect reference counters.
Incorrect directory sizes.
Incorrect inode formats.
Blocks which are not listed anywhere.
Directory checks, files which point to an unassigned inode, inode numbers outside the allocated range, omission of ’.' and ’..' as the first directory entry.
Superblock checks: More blocks for inodes than are present in the file system.
Incorrect format for free block list.
Total of free blocks and/or free inodes incorrect.
If the user agrees, orphaned files or directories (i.e. allocated but unreferenced) are relinked through being written to the lost+found directory. The allocated name corresponds to the inode number. If the lost+found directory does not yet exist it is created at this point. If not enough space is available, the directory is extended.
To designate a file system you may specify the name of the block or character-oriented device on which it is located or the name of the mountpoint.
Syntax
fsck[ -F ufs|UFS][ -y|-n|-m][ special_file ...] |
Specifies ufs as the file system type.
All inconsistencies are checked. The questions asked by fsck are answered with "yes".
All inconsistencies are checked. The questions asked by fsck are answered with "no".
The status in the file system’s superblock is checked. This option ensures that the file system is suitable for mounting.
special_file represents a block or character special device (for example, /dev/dsk/234). It is preferable to use a character special device. fsck cannot be applied to mounted block special devices. special_file not specified: |
Hint
In almost all cases it is quicker to examine character-oriented devices. The check of all the inconsistencies can take a very long time depending on the size and utilization level of the file system. The fsck command is not supported for bs2fs file systems. |
File
lost+found /etc/vfstab List of default parameters for each file system |
See also
mount, mountall, umount |