Fsck

From Hackepedia
Revision as of 05:29, 5 June 2008 by Pbug (talk | contribs)
Jump to navigationJump to search

The filesystem consistency check and interactive repair program is needed on several UBO filesystems. When a filesystem is not properly unmounted before a reboot or halt, the filesystem must be checked and any inconsistencies repaired. This can be a lengthy process and FreeBSD has a background fsck so that the system can start while it works away at making the filesystem consistent.

If you shut down improperly on Linux and know you will have to answer "yes" many times, you can simply add the -y flag which means say yes to the prompts:

# fsck -y

If you have a journalling filesystem you don't need to fsck.

If the superblock is corrupted fsck won't work without the -b option which you have to state one of several backup superblocks. Knowledge of the backup superblock is only known if the administrator keeps a record of where the backup block are (mostly from newfs time). There is a way to use newfs to display the superblocks and not write into the filesystem (use with the dumpfs -m command in conjunction).

# fsck -y -b 32

It's good to have the following things stored offsite in order to repair a filesystem:

fdisk of disk
disklabel of disk
newfs / newfs -N (dumpfs -m)

If you have this information on a floppy next to the backup tapes you greatly increase your chances to repair your data if it's corrupted.