FSCK
( filesystem check )
Every 20 to
30 times you boot up your computer, after an improper shutdown or
power-faillure, the system will perform a filesystem check.
In
most cases no problem, however, sometimes in rare cases it may ask you
if you want to repair inconsistencies; you press "y" and "Enter" a few
times and it will proceed booting.
In some very rare cases it will tell you that you have to do a manual
fsck and give you a prompt:
( Now you have to know what partition ( hda? ) was the critical one ! )
( Replace the "?" with the partition number ) The "-p" stands for repair automatically.
| CODE |
| #
e2fsck -f /dev/hda? |
( Replace the "?" with the partition number ) e2fsck is a modern, more powerfull version of fsck. The "-f" option forces a more elaborate check.
Sometimes
the system tells you to do the check without the "-p"
argument, this just means you will have to say "y" a lot of times !
In
some very, very rare cases an emergency console will come up, just do
the above at the prompt and when done close the console with "Ctrl+d" and the system will continue booting.
If you get these errors often:
| CODE |
| #
e2fsck -c /dev/hda? |
( Replace the "?" with the partition number )
This will mark bad blocks on your HD and no more data will be written
in those blocks.
( !!! fsck and e2fsck should only be
performed on unmounted
partitions !!!! )
In very, very, very rare cases a "Super-Block" might get damaged:
( First make some strong coffee ! )
A
super-block is the first block of each ext2 or ext3 partition. It has
important data about the file system, like size, free space, etc.
A
partition with a damaged super-block cannot be mounted. But, ext2 and
ext3 keep several super-block backup copies scattered over the
partition.
Boot your system with a boot disk. ( I hope you did make one !
) The location of the super-block backup copies depends on the block
size of the file system.
For
file systems with 1 KB block size it is at the beginning of each 8 KB
(8192 bytes), for file systems with 2 KB sizes it is at the beginning
of each 16 KB (16384 bytes) and so on.
You can use:
| CODE |
| #
mke2fs -n /dev/hda? |
to find out at which byte positions the super-block copies are. With a
1 KB block size, the first backup copy is in byte number 8193 ( 8192+1
).
To restore the super-block from this copy, do:
| CODE |
| #
e2fsck -b 8193 /dev/hda? |
If that block also happens to be damaged, try the next one at byte
number 16385, and so on until you find a good one.
Reboot to activate the changes.

Bruno
-- Apr 28 2003 ( Revised Mar 27 2008 ) --