Search

Tuesday 29 September 2009

How to recover from linux disk errors


Run the following command on the offending disk (this needs to be done from a boot CD):
fsck
i.e. fsck /dev/hda2
If fsck reports superblock errors then dump out the superblock info:
dumpe2fs /dev/hda2 | grep superblock
Once you get the output from this, pass a backup superblock back to the device:
fsck – b XXXXX /dev/hda2 (where XXXXX is the backup superblock number and HDA2 is the device)
If not of these work, create a bit for bit copy of the drive with DD:
dd if=/dev/hda of=/mnt/recovery/hdimage.dd
Then run fsck on the image:
fsck /mnt/recovery/hdimage.dd
Then mount the image as a loopback device:
mount -0 loop /mnt/recovery/hdimage.dd /mnt/hdimage
Then look at the mounted hdimage mount to see if data is there.
You can also use the Foremost data carving app available from:
http://foremost.sourceforge.net
Example – foremost hdimage.dd

No comments:

Post a Comment