DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Solving filesystem problems

Using fsck_s5 to check inodes

The list of inodes is checked sequentially starting with inode 1 (there is no inode 0). Each inode is checked for inconsistencies involving:

Using fsck_s5 to check format and type

Each inode contains a mode word. This mode word describes the type and state of the inode. Inodes can be one of six types:

Inodes can be in one of three states: unallocated, allocated, and partially allocated. This last state means the inode is incorrectly formatted. An inode can get into this state if, for example, bad data are written into the inode list because of a hardware failure. The only corrective action fsck can take is to clear the inode.

Using fsck_s5 to check link count

Each inode contains a count of the number of directory entries linked to it. The fsck program verifies the link count of each inode by examining the entire directory structure, starting from the root directory, and calculating an actual link count for each inode.

Discrepancies between the link count stored in the inode and the actual link count as determined by fsck can be due to one of the following:

Using fsck_s5 to check duplicate blocks

Each inode contains a list of all the blocks claimed by the inode. The fsck program compares each block number claimed by an inode to a list of allocated blocks. If a block number claimed by an inode is on the list of allocated blocks, it is put on a list of duplicate blocks. If it is not on the list of allocated blocks, it is put on it.

If this process produces a list of duplicate blocks, fsck makes a second pass of the inode list to find the other inode that claims each duplicate block. (A large number of duplicate blocks in an inode might be caused by an indirect block not being written to the filesystem.)

Although it is not possible to determine with certainty which inode is in error, in most cases the inode with the most recent modification time is correct. The fsck program prompts the user to clear both inodes.

Using fsck_s5 to check bad block numbers

The fsck program checks each block number claimed by an inode to see that its value is higher than that of the first data block and lower than that of the last block in the filesystem. If the block number is outside this range, it is considered a bad block number.

Bad block numbers in an inode can be caused by an indirect block not being written to the filesystem. The fsck program prompts the user to clear the inode.


NOTE: A bad block number in a filesystem is not the same as a bad (unreadable) block on a hard disk.

Using fsck_s5 to check inode size

Each inode contains a 32-bit (4-byte) size field. This field shows the number of characters in the file associated with the inode. A directory inode within the filesystem has the directory bit set in the inode mode word.

If the directory size is not a multiple of 16, fsck warns of directory misalignment and prompts for corrective action.

For a regular file, a rough check of the consistency of the size field of an inode can be performed by using the number of characters shown in the size field to calculate how many blocks to associate with the inode and comparing that to the actual number of blocks claimed by the inode.

When fsck detects an incorrect file size, it prompts you to choose whether to truncate the file or expand the file to match the number of blocks allocated. Increasing the file size might produce unwanted data at the end of your file; truncating the file might destroy data in the last few blocks.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004