All went well for the 1st month or so, I had a full backup and had updated the backup at least five times in that month. I even deleted some of the really old (but you still want to keep) data off of my linux box, thinking "I have a backup so I can delete this". Then one day the unthinkable happened, I plugged the USB drive in and nothing happened, not even the power light was on. I tried again and again, even tried a different power supply, but nothing worked. I began to panic, I did not want to pay lots of money for some company to recover the data, and the data was very personal too, so I decided to break the casing and plug the disk directly into my linux system, all the while praying that it was just the power source and not the disk itself that was broken.
I installed it into my drive cage as an internal drive, fired up the system and was overjoyed to see the disk in the "fdisk -l" listing, and it even showed the partition. My joy soon turned to panic when I tried to mount the filesystem, the partition was un-mountable. I checked with gdisk and sure enough gdisk did not see a partition on the drive, now I was beginning to panic. For anyone not familiar with gdisk, I suggest you read up at this site - this is the gdisk creator's site and is a wealth of information. I tried almost everything on the repairing GPT disks section, except things that warned about erasing all the data, but nothing worked. I was also stupid enough NOT to make a backup of the partition table after I originally created it (gdisk "b" option on the main screen), so I was almost ready to throw in the towel and give up.
Then I had a brain wave (yes they do come to me sometimes, not too often though). If I bought an identical new disk, copied the disk data - byte for byte over to the new disk, then I could at least try some of the other (riskier) options of gdisk that might end up erase all the data, but may also fix the problem.
After buying the new disk I had an even bigger brain wave - what if I create an empty ext4 partition on the new blank disk, then save the partition table to a file before I copy the disks, so that once the copy was finished I could load the partition table data back in to the "broken" disk.
So the steps outlined below are how I managed to recover my "broken" disk.
- Install the new drive and format it with GPT and a single ext4 filesystem.
- gdisk - option o "create a new empty GUID partition table (GPT)"
- gdisk - option n "add a new partition"
- gdisk - option w "write table to disk and exit"
- Then I went back into gdisk and saved the partition table to a disk file.
- gdisk - option b "back up GPT data to a file"
- Now came time to copy the physical data to the new drive. P.S. this will wipe the current partition table just created, that is why I saved it to a disk file before the copy. I also suggest you monitor the system log to make sure there are no read/write errors on any of the two disks being used (tail -f /var/log/messages or tail -f /var/log/syslog)
- dd if=/dev/sdb of=/dev/sdc (This took over 1 day, 5 hours)
- Lastly it was now time to load the backed up partition table data file into the "broken" disk and pray for a miracle.
- gdisk - option r "recovery and transformation options (experts only):
- gdisk - option l "load partition data from a backup file"
- gdisk - option w "write table to disk and exit"
Mission impossible had been accomplished...
No comments:
Post a Comment