Tuesday 5 October 2010

Linux disk recovery

After any power problem with the linux machine, the filesystem could be corrupted and you may not be able to login. When this happens, you will need e2fsck, the tool to recover ext2 or ext3 partitions. (Do not ever use it with a partition that has AFS or another format).

Boot with a live cd or the first cd of Redhat and write "linux rescue".
Do not let the rescue mode to detect the linux partitions, else it would mount them and you do not want to mount the partitions yet, the file system check (e2fsck) can cause severe problems on a mounted partition.

When you are at the rescue mode prompt, write:

# e2fsck -c -c -v -y /dev/hda1
It is important to user "-c -c" (twice) this means that badblocks will scan using a non-destructive read-write test.
"-v" to verbose and see the status of fsck.
"-y" says to answer "yes" to all the questinons from fsck.

No comments: