Using TestDisk to recover partitions, partition tables and boot sectors
Recently I had an issue with a MDX1000 external array and RedHat Enterprise Linux 5.4 where after I installed the OS and formatted /dev/sda to be a volume group the OS could not find the partition table for /dev/sdb. I wasn't too concerned during the installation process because I wasn't using that disk anyway but I definitely wanted to keep the 1.7TB partition since it had a lot of data on there that I did not want to recover from tape. Once the install was done, I was unable to mount /dev/sdb1 and a fdisk -l was not showing any partitions on the disk - this obviously was bad. To further compound matters, the total size of this array was 3.9TB which fdisk could not handle since it was larger than 2.2TB and I needed to use parted to try to get it work.
Once I got into parted, I discovered that the partition table was corrupted and needed to be rebuilt. I then found the utility testdisk which will work on Windows or Linux and does a great job of allowing you to find lost partitions and backup superblocks on the disk. I had the software recreate the partition table and set it to a EFI disk which allowed larger than 2.2TB disks and then it was able to find the lost partition with all of my data intact. I wrote the new partition table to disk and rebooted the server and was then able to successfully mount and use /dev/sdb1 just as it was before the 64 bit "upgrade" of the server.
I have not personally tried this yet on Windows or another flavor of Unix but I am now a big believer in this tool when all seems lost. And you can't beat the price: free.

3 Comments:
At December 27, 2009 6:46 PM ,
WaterWingz said...
I ran into what is probably a much easier problem with a HD on a laptop. Having made a bunch of dumb mistakes trying to use my WinXP installation disk to restore the lost hard drive, I realized that I was essentially making things worse. I got to the point where everthing I tried reported a blank harddive. Not good.
Using testdisk via a bootable Linux CD (Linux Mint), I was able to restore the partitions so that I could copy off all my data.
An amazingly good feeling when you were previously facing losing everything.
Tony
At December 27, 2009 6:46 PM ,
WaterWingz said...
by the way - do you realize what the initials RMS mean to the Linux / open source community ?
Tony
At December 27, 2009 7:38 PM ,
Rick Mitchell Solutions said...
RMS is kind of a big deal in the open source community - haha.
Post a Comment
Links to this post:
Create a Link
<< Home