Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I was reading a blog post about filesystem repair and the author posted a good question… fsck -p is supposed to fix minor errors automatically without human intervention. But what exactly will it fix when it's told to preen the filesystem? What errors will it fix, and what will cause it to stop and tell the user he or she must run fsck interactively? Is there a list of some kind?

I've been Googling around and all I find is the man page, which doesn't really tell what -p will fix or what triggers the hands-on flag. I'm specifically interested in the ext4 filesystem.

share|improve this question
    
This is completely dependent on the filesystem, which one did you have in mind? –  Gilles Aug 10 '11 at 23:35
    
@Gilles: ext4 filesystem –  Bart Silverstrim Aug 11 '11 at 0:05

1 Answer 1

up vote 10 down vote accepted

The answer to your question lies in the e2fsck/problems.c file of the e2fsprogs source code. Looking for the PR_PREEN_OK flag should get you started.

As the complete error handling is a bit more involved, due to the multitude of different error conditions that may occur, you are advised to have a closer look at the code if you are concerned about a specific case. However, the lists below were extracted from the comments to the error conditions and should give you a rough overview about the effects of the preen-mode.

The following errors/warnings are currently handled automatically when the -p flag is specified:

  • Relocate hint
  • Journal inode is invalid
  • Journal superblock is corrupt
  • Superblock has_journal flag is clear but has a journal
  • Superblock needs_recovery flag is set but not journal is present
  • Filesystem revision is 0, but feature flags are set
  • Superblock hint for external superblock
  • group descriptor N marked uninitialized without feature set.
  • group N block bitmap uninitialized but inode bitmap in use.
  • Group descriptor N has invalid unused inodes count.
  • Last group block bitmap uninitialized.
  • The test_fs flag is set (and ext4 is available)
  • Last mount time is in the future (fudged)
  • Last write time is in the future (fudged)
  • Block group checksum (latch question) is invalid.
  • Root directory has dtime set
  • Reserved inode has bad mode
  • Deleted inode has zero dtime
  • Inode in use, but dtime set
  • Zero-length directory
  • Inode has incorrect i_size
  • Inode has incorrect i_blocks
  • Bad superblock in group
  • Bad block group descriptors in group
  • Block claimed for no reason
  • Error allocating blocks for relocating metadata
  • Error allocating block buffer during relocation process
  • Relocating metadata group information from X to Y
  • Relocating metatdata group information to X
  • Block read error during relocation process
  • Block write error during relocation process
  • Immutable flag set on a device or socket inode
  • Non-zero size for device, fifo or socket inode
  • Filesystem revision is 0, but feature flags are set
  • Journal inode is not in use, but contains data
  • Journal has bad mode
  • INDEX_FL flag set on a non-HTREE filesystem
  • INDEX_FL flag set on a non-directory
  • Invalid root node in HTREE directory
  • Unsupported hash version in HTREE directory
  • Incompatible flag in HTREE root node
  • HTREE too deep
  • invalid inode->i_extra_isize
  • invalid ea entry->e_name_len
  • invalid ea entry->e_value_offs
  • invalid ea entry->e_value_block
  • invalid ea entry->e_value_size
  • invalid ea entry->e_hash
  • inode missing EXTENTS_FL, but is an extent inode
  • Inode should not have EOFBLOCKS_FL set
  • Directory entry has deleted or unused inode
  • Directory filetype not set
  • Directory filetype set on filesystem
  • Invalid HTREE root node
  • Invalid HTREE limit
  • Invalid HTREE count
  • HTREE interior node has out-of-order hashes in table
  • Inode found in group where _INODE_UNINIT is set
  • Inode found in group unused inodes area
  • i_blocks_hi should be zero
  • /lost+found not found
  • Unattached zero-length inode
  • Inode ref count wrong
  • Padding at end of inode bitmap is not set.
  • Padding at end of block bitmap is not set.
  • Block bitmap differences header
  • Block not used, but marked in bitmap
  • Block used, but not marked used in bitmap
  • Block bitmap differences end
  • Inode bitmap differences header
  • Inode not used, but marked in bitmap
  • Inode used, but not marked used in bitmap
  • Inode bitmap differences end
  • Free inodes count for group wrong
  • Directories count for group wrong
  • Free inodes count wrong
  • Free blocks count for group wrong
  • Free blocks count wrong
  • Block range not used, but marked in bitmap
  • Block range used, but not marked used in bitmap
  • Inode range not used, but marked in bitmap
  • Inode range used, but not marked used in bitmap
  • Group N block(s) in use but group is marked BLOCK_UNINIT
  • Group N inode(s) in use but group is marked INODE_UNINIT
  • Recreate journal if E2F_FLAG_JOURNAL_INODE flag is set

The following error conditions cause the non-interactive fsck process to abort, even if the -p flag is set:

  • Block bitmap not in group
  • Inode bitmap not in group
  • Inode table not in group
  • Filesystem size is wrong
  • Inode count in superblock is incorrect
  • The Hurd does not support the filetype feature
  • Journal has an unknown superblock type
  • Ask if we should clear the journal
  • Journal superblock has an unknown read-only feature flag set
  • Journal superblock has an unknown incompatible feature flag set
  • Journal has unsupported version number
  • Ask if we should run the journal anyway
  • Reserved blocks w/o resize_inode
  • Resize_inode not enabled, but resize inode is non-zero
  • Resize inode invalid
  • Last mount time is in the future
  • Last write time is in the future
  • group descriptor N checksum is invalid.
  • Root directory is not an inode
  • Block bitmap conflicts with some other fs block
  • Inode bitmap conflicts with some other fs block
  • Inode table conflicts with some other fs block
  • Block bitmap is on a bad block
  • Inode bitmap is on a bad block
  • Illegal blocknumber in inode
  • Block number overlaps fs metadata
  • Inode has illegal blocks (latch question)
  • Too many bad blocks in inode
  • Illegal block number in bad block inode
  • Bad block inode has illegal blocks (latch question)
  • Bad block used as bad block indirect block
  • Inconsistency can't be fixed prompt
  • Bad primary block prompt
  • Suppress messages prompt
  • Imagic flag set on an inode when filesystem doesn't support it
  • Compression flag set on an inode when filesystem doesn't support it
  • Deal with inodes that were part of orphan linked list
  • Deal with inodes that were part of corrupted orphan linked list (latch question)
  • Error reading extended attribute block
  • Invalid extended attribute block
  • Extended attribute reference count incorrect
  • Multiple EA blocks not supported
  • Error EA allocation collision
  • Bad extended attribute name
  • Bad extended attribute value
  • Inode too big (latch question)
  • Directory too big
  • Regular file too big
  • Symlink too big
  • Bad block has indirect block that conflicts with filesystem block
  • Resize inode failed
  • inode appears to be a directory
  • Error while reading extent tree
  • Failure to iterate extents
  • Bad starting block in extent
  • Extent ends beyond filesystem
  • EXTENTS_FL flag set on a non-extents filesystem
  • inode has extents, superblock missing INCOMPAT_EXTENTS feature
  • Fast symlink has EXTENTS_FL set
  • Extents are out of order
  • Inode has an invalid extent node
  • Clone duplicate/bad blocks?
  • Bad inode number for '.'
  • Directory entry has bad inode number
  • Directry entry is link to '.'
  • Directory entry points to inode now located in a bad block
  • Directory entry contains a link to a directory
  • Directory entry contains a link to the root directry
  • Directory entry has illegal characters in its name
  • Missing '.' in directory inode
  • Missing '..' in directory inode
  • First entry in directory inode doesn't contain '.'
  • Second entry in directory inode doesn't contain '..'
  • i_faddr should be zero
  • i_file_acl should be zero
  • i_dir_acl should be zero
  • i_frag should be zero
  • i_fsize should be zero
  • inode has bad mode
  • directory corrupted
  • filename too long
  • Directory inode has a missing block (hole)
  • '.' is not NULL terminated
  • '..' is not NULL terminated
  • Illegal character device inode
  • Illegal block device inode
  • Duplicate '.' entry
  • Duplicate '..' entry
  • Final rec_len is wrong
  • Error reading directory block
  • Error writing directory block
  • Directory entry for '.' is big. Split?
  • Illegal FIFO inode
  • Illegal socket inode
  • Directory filetype incorrect
  • Directory filename is null
  • Invalid symlink
  • i_file_acl (extended attribute block) is bad
  • Filesystem contains large files, but has no such flag in sb
  • Clear invalid HTREE directory
  • Bad block in htree interior node
  • Duplicate directory entry found
  • Non-unique filename found
  • i_blocks_hi should be zero
  • Unexpected HTREE block
  • Root inode not allocated
  • No room in lost+found
  • Unconnected directory inode
  • .. entry is incorrect
  • Lost+found not a directory
  • Unattached inode
  • Superblock corrupt
  • Fragments not supported
  • Error determing physical device size of filesystem
  • The external journal has (unsupported) multiple filesystems
  • Can't find external journal
  • External journal has bad superblock
  • Superblock has a bad journal UUID
  • Error allocating inode bitmap
  • Error allocating block bitmap
  • Error allocating icount link information
  • Error allocating directory block array
  • Error while scanning inodes
  • Error while iterating over blocks
  • Error while storing inode count information
  • Error while storing directory block information
  • Error while reading inode (for clearing)
  • Error allocating refcount structure
  • Error reading Extended Attribute block while fixing refcount
  • Error writing Extended Attribute block while fixing refcount
  • Error allocating EA region allocation structure
  • Error while scanning inodes
  • Error allocating inode bitmap
  • Internal error: couldn't find dir_info
  • Error allocating icount structure
  • Error iterating over directory blocks
  • Error deallocating inode
  • Error adjusting EA refcount
  • Error allocating inode bitmap
  • Error creating root directory
  • Root inode is not directory; aborting
  • Cannot proceed without a root inode.
  • Internal error: couldn't find dir_info
  • Programming error: bitmap endpoints don't match
  • Internal error: fudging end of bitmap
  • Error copying in replacement inode bitmap
  • Error copying in replacement block bitmap
share|improve this answer
    
Excellent! Thank you! –  Bart Silverstrim Aug 11 '11 at 11:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.