|
|
Directory data blocks are checked for inconsistencies involving:
If the inode number in a directory data block references an unallocated inode, fsck removes that directory entry.
If a directory entry inode number references outside the inode list, fsck removes that directory entry. This condition occurs if bad data is written into a directory data block.
The directory inode number entry for ``.'' must be the first entry in the directory data block. The inode number for ``.'' must reference itself; for example, it must equal the inode number for the directory data block. The directory inode number entry for ``..'' must be the second entry in the directory data block. Its value must equal the inode number for the parent of the directory entry (or the inode number of the directory data block if the directory is the root directory). If the directory inode numbers are incorrect, fsck replaces them with the correct values. If there are multiple hard links to a directory, the first one encountered is considered the real parent to which ``..'' should point; fsck recommends deletion for the subsequently discovered names.
fsck checks the general connectivity of the filesystem. If directories are not linked into the filesystem, fsck links the directory back into the filesystem in the lost+found directory.