Filesystem Corruption

I recently had a disaster with my 2TB external hard disk which held backups of all the important things such as documents, CDs and pictures. I was mainly upset about the pictures as the CDs I can re-rip and the documents I have on another disk as well.

I forgot to turn it off so the disk must have got too hot as my study does not have air conditioning so it gets a bit warm in there.

The log files showed that there was a physical error on the disk and it refused to mount. Running the following command:

sudo mke2fs -n /dev/(device no)

to get the list of backup blocks and then choosing a backup block from the list at the end of the output from the command. I then ran the following

sudo e2fsck -b(backup superblock no) -cc /dev/(device no)

However this took a long time to run and didn’t work.

I was at a loss so I found a post on a gentoo forum

http://forums.gentoo.org/viewtopic-t-522872-start-0-postdays-0-postorder-asc-highlight-solved+ext3+illegal.html

and used one of the the replies where the author ran the following command with success

dd if=/dev/main/home of=/dev/sdb7 conv=noerror,sync

So I went out and purchased a new 2TB drive and then adjusted the command to copy from my old 2TB drive to the new one.

dd if=/dev/sdb1 of=/dev/sdc1 conv=noerror,sync

However this took took six days to complete, however at the end of it I was not able to recover any information. the standard sudo fsck -y /dev/device no worked for a while but then ran out of memory. So I ended up creating a config file in /etc/ called e2fsck.conf

and creating a section called scratch_files this allowed e2fsck to use the hard disk for swap space.
[scratch_files]
directory = /home/cache/e2fsck (This can be any folder on a partition with plenty of disk space)
dirinfo=false


However it still stopped with a memory error. After re-running the fsck command with -t ext4 which was the filesystem type I’d created the partition as I found that it ran, however no information was recoverable. So I re-ran the dd command again and tried again. I also tried the demo rr-studio for linux and that was not able to recover any information either I tried this software as I’ve had a great deal of success with recovering from windows partitions and ext2 partitions in the past with this software.

So with a final attempt I then re-ran the dd command again and 6 days later I got the filesystem onto the new disk I then ran

fsck.ext4 -v /dev/sdc1

The problem was I’d forgotten what the partition type that I created was. With the filesystem corruption gparted was not able to tell me. This worked and I got most of my data back. A few non essential files disappeared but they were not important. I got my pictures back! It only took me 18 days, using USB 2.0. I wonder how long it would take with USB 3.0. I now have a note on what disks I have formatted with what filesystem type synced using dropbox so I can get the information in the event of a failure.

UPDATE:

I recently have had to run this again, the disk I recovered the information too, also failed and will not start. Fortunately I had not got around to taking the failed disk to the shop, allowing me to get the information back using the above steps. These steps work fine. I wish dd had a better way to show progress.

 

Leave a Reply

Your email address will not be published. Required fields are marked *