fsck Command – Check & Repair Linux & Unix File Systems

Phase 2: check pathnames

fsck error messages, warning messages and responses for Phase 2 -check pathnames.
This phase checks the file paths & removes directory entries pointing to bad inodes found in Phases 1 and 1B above .

The following type of errors are reported.:

  1. incorrect root inode mode and status
  2. directory inode pointers out of range
  3. directory entries pointing to bad inodes
  4. directory integrity checks

All errors in this phase are fatal if the filesystem is being repaired, except for directories not being a multiple of the block size and extraneous hard links.

2.1) ROOT INODE UNALLOCATED (ALLOCATE)

The root inode has no allocated mode bits

Possible responses to the ALLOCATE prompt are:

YES : Allocate inode 2 as the root inode. The files and directories usually found in the root will be recovered in Phase 3 and put into the lost+found directory. If the attempt to allocate the root fails, fsck exits with the message: CANNOT ALLOCATE ROOT INODE

No , Terminate the program.

2.2 ) ROOT INODE NOT DIRECTORY (REALLOCATE)

The root inode (usually inode number 2) of the file system is not a directory inode.

Possible responses to the REALLOCATE prompt are:

Yes : Clear the existing contents of the root inode and reallocate it. The files and directories usually found in the root will be recovered in Phase 3 and put into the lost+found directory. If the attempt to allocate the root fails, fsck exits with the message:
NO CANNOT ALLOCATE ROOT INODE

fsck prompts with FIX.

Possible responses to the FIX prompt are:

YES : Change the type of the root inode to directory.
If the root inode’s data blocks are not directory blocks, many error messages are generated.

No : Terminate the program.

2.3 ) DUPS/BAD IN ROOT INODE (REALLOCATE)

Phase 1 or Phase 1B has found duplicate blocks or bad blocks in the root inode (usually inode number 2) of the file system.

Possible responses to the REALLOCATE prompt are:

YES Clear the existing contents of the root inode and reallocate it. The files and directories usually found in the root will be recovered in Phase 3 and put into the lost+found directory. If the attempt to allocate the root fails, fsck exits with the message:
CANNOT ALLOCATE ROOT INODE
NO fsck prompts with CONTINUE.

Possible responses to the CONTINUE prompt are:
YES Ignore the DUPS/BAD error condition in the root inode and try to continue running the
file system check. If the root the inode number s not correct, this can generate many other error messages.

NO Terminate the program.

2.4) NAME TOO LONG File

A very long pathname has been found indicating the loops in the file system

2.5) I OUT OF RANGE I=NAME=F (REMOVE)

A directory entry F has an inode number I that is greater than the end of the inode list.

Possible responses to the REMOVE prompt are:
YES Remove the directory entry F.

NO Ignore this error condition.

2.6 ) UNALLOCATED I=OWNER=O MODE=M SIZE=S MTIME=T TYPE=F (REMOVE)

A directory or file entry F points to an unallocated the inode number . The owner O, mode M, size S, modify time T, and name F are printed.

Possible responses to the REMOVE prompt are:

YES Remove the directory entry F.

NO Ignore this error condition.

2.7 ) DUP/BAD I=OWNER=O MODE=M SIZE=S MTIME=T TYPE=F (REMOVE)

Phase 1 or Phase 1B has found duplicate blocks or bad blocks associated with directory or file entry F, the inode number . The owner O, mode M, size S, modify time T, and directory name F are printed.

Possible responses to the REMOVE prompt are:

YES Remove the directory entry F.

NO Ignore this error condition.

2.8) ZERO LENGTH DIRECTORY I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F (REMOVE)

A directory entry F has a size S that is zero. The owner O, mode M, size S, modify time T, and directory name F are printed.

Possible responses to the REMOVE prompt are:

YES Remove the directory entry F; this generates the BAD/DUP error message in Phase 4.

NO Ignore this error condition.

2.9) DIRECTORY TOO SHORT I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)

A directory F has been found whose size S is less than the minimum size directory. The owner O, mode M, size S, modify time T, and directory name F are printed.

Possible responses to the FIX prompt are:

YES Increase the size of the directory to the minimum directory size.

NO Ignore this directory.

2.10) DIRECTORY F LENGTH S NOT MULTIPLE OF B (ADJUST)

A directory F has been found with size S that is not a multiple of the directory block size B.

Possible responses to the ADJUST prompt are:

YES Round up the length to the appropriate block size. When the file system is being
repaired, only a warning is printed and the directory is adjusted.

NO Ignore the error condition.

211) DIRECTORY CORRUPTED I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F (SALVAGE)

A directory with an inconsistent internal state has been found.

Possible responses to the SALVAGE prompt are:

YES Throw away all entries up to the next directory boundary (usually a 512-byte boundary). This drastic action can throw away up to 42 entries, and should be taken only after other recovery efforts have failed.

NO Skip to the next directory boundary and resume reading, but do not modify the directory.

2.12) BAD INODE NUMBER FOR `.’ I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)

A directory I has been found whose inode number for “.” does not equal I.

Possible responses to the FIX prompt are:

YES Change the inode number for “.” to be equal to I.

NO Leave the inode number for “.” unchanged.

2.13) MISSING `.’ I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)

A directory I has been found whose first entry is unallocated.

Possible responses to the FIX prompt are:

YES Build an entry for “.” with inode number equal to I.

NO Leave the directory unchanged.

2.14) MISSING `.’ I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS F

A directory I has been found whose first entry is F. fsck cannot resolve this problem. The
file system should be mounted and entry F moved elsewhere. The file system should then be unmounted and fsck should be run again.

2.15) MISSING `.’ I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F CANNOT FIX, INSUFFICIENT SPACE TO ADD `.’

A directory I has been found whose first entry is not “.”. This is very rare. fsck cannot resolve the problem.

2.16) EXTRA `.’ ENTRY I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F(FIX)

A directory I has been found that has more than one entry for “.”.

Possible responses to the FIX prompt are:

YES Remove the extra entry for “.”.

NO Leave the directory unchanged.

2.17) BAD INODE NUMBER FOR `..’ I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)

A directory I has been found whose inode number for “..” does not equal the parent of I.

Possible responses to the FIX prompt are:

YES Change the inode number for “..” to be equal to the parent of I. (Note that “..” in the root inode points to itself.)

NO Leave the inode number for “..” unchanged.

2.18) MISSING `..’ I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)

A directory I has been found whose second entry is unallocated.

Possible responses to the FIX prompt are:

YES Build an entry for “..” with inode number equal to the parent of I. (Note that “..” in the root inode points to itself.)

NO Leave the directory unchanged.

2.19) MISSING `..’ I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F CANNOT FIX, SECOND ENTRY IN DIRECTORY CONTAINS F

A directory I has been found whose second entry is F. fsck cannot resolve this problem. The
file system should be mounted and entry F moved elsewhere. The file system should then be unmounted and fsck should be run again.

2.20) MISSING `..’ I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F CANNOT FIX, INSUFFICIENT SPACE TO ADD `..’

A directory I has been found whose second entry is not “..” (the parent directory). fsck cannot resolve this problem. The
file system should be mounted and the second entry in the directory moved elsewhere. The
file system should then be unmounted and fsck should be run again.

2.21 ) EXTRA `..’ ENTRY I=OWNER=O MODE=M SIZE=S MTIME=T DIR=F(FIX)

A directory I has been found that has more than one entry for “..” (the parent directory).

Possible responses to the FIX prompt are:

YES Remove the extra entry for “..” (the parent directory).

NO Leave the directory unchanged.

2.22) N IS AN EXTRANEOUS HARD LINK TO A DIRECTORY D (REMOVE)

fsck has found a hard link N to a directory D. When preening, the extraneous links are ignored.

Possible responses to the REMOVE prompt are:

YES Delete the extraneous entry N.

NO Ignore the error condition.

2.23) BAD INODE S TO DESCEND

An internal error has caused an impossible state S to be passed to the routine that descends the
file system directory structure. fsck exits.

2.24) BAD ENTER STATE S FROM DESCEND

An internal error has caused an impossible state S to be returned from the routine that descends the
file system directory structure. fsck exits. If you encounter this error.

2.25) BAD STATE S FOR ROOT INODE

An internal error has caused an impossible state S to be assigned to the root inode. fsck exits.

Initialization Phase
** phase 1 – Check Blocks and Sizes
** phase 2 – Check Pathnames

NEXT>>
** phase 3 – Check Connectivity

** phase 4 – Check Reference Counts
** phase 5 – Check Cylinder Groups
cleanup phase

2 thoughts on “fsck Command – Check & Repair Linux & Unix File Systems

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.