Sunday, May 17, 2009

File System Check using fsck

I won't begin to claim I know everything in Linux, but I'm learning. In most Linux systems if there is a crash or the OS suspects disk failure, the utility fsck will run at boot automatically. You can however run it manually from the shell as root. Here is the syntax for fsck:

fsck 1.41.3 (12-Oct-2008)
Usage: fsck.ext3 [-panyrcdfvtDFV] [-b superblock] [-B blocksize]
[-I inode_buffer_blocks] [-P process_inode_size]
[-l|-L bad_blocks_file] [-C fd] [-j external_journal]
[-E extended-options] device

Emergency help:
-p Automatic repair (no questions)
-n Make no changes to the filesystem
-y Assume "yes" to all questions
-c Check for bad blocks and add them to the badblock list
-f Force checking even if filesystem is marked clean
-v Be verbose
-b superblock Use alternative superblock
-B blocksize Force blocksize when looking for superblock
-j external_journal Set location of the external journal
-l bad_blocks_file Add to badblocks list
-L bad_blocks_file Set badblocks list

Since my experience is limited with Linux, I will refer you to the fsck listing in Wikipedia and also the MAN pages for fsck. If the occasion arises and you need to run this tool manually, read these pages first. No one ever wants to have to run tools like these but they can and often will save the day when disk errors surface.

1 comment:

Techbits reserves the right to not publish comments but will only exercise this right if a comment is vulgar, completely off-topic or spam.