Operating Systems

Disk Drive Disaster

I imagine there’s a special place in Hell for people who don’t backup their important files. If there is, I am sure they are saving a spot for me :). You probably get tortured by having to recover your drive with nothing but a Windows recovery disk and a few floppies and if you actually succeed your disk crashes again and you have to start over, Sisyphus style.

Now, I have recovered from more than one logical disk failure and I’ve learned a few things – backing up not being one of them it seems :P. Seriously though, I do backup but not everything and not as regularly as I should. I don’t have for example a backup of my music and my ebook collection. Losing my music could be a bit tragic but I would recover. I do have a backup of my projects, my precious code and documents I wrote, via a SVN server that I keep on my router which has a disk drive attached. That might not be enough if you’re paranoid but hey… we all lose something at some point. Another thing I backup are my general documents – I hadn’t done a recent backup though, and the pictures I took – these are truly irreplaceable and I usually keep at least 2 copies for redundancy. Sometimes I use online services as well to keep my pictures safe.

Backup is nice but hey, nobody really prepares for the worst so I will discuss things you can do if disaster really hits you hard. These are things I learned over time from my own mistakes.

Hard drive failures are of two types: logical and physical.

I do not  have any experience with physical drive failures, I admit. I’ve always used quality disk drives and I renew them every two years or so, buying newer, better ones. Since hard drive capacity grows exponentially with time you can always buy a bigger disk which will replace your old one leaving you with plenty of room to spare. I’ve even experimented with a RAID striping setup. I don’t recommend it for keeping your most important files. Software RAIDs are prone to failure – yeah, mine failed too. True hardware RAID is expensive and you have to buy specialized hardware. It wasn’t that big a deal when my nForce RAID failed because I didn’t keep very important files on it – just the OS which was easy to reinstall and files I downloaded and could recover. So when it started failing I dismantled it and formatted the drives that made up my RAID. I’ve heard about other people who lost their RAIDs and didn’t recover much. So let’s keep it simple: use a RAID if you want to speed up your OS or something or use one of the RAIDs that provide data mirroring for data safety. Any RAID that does data striping reduces your data safety. A n-disks striping RAID will have a MTBF(mean time between failures) equal to the MTBF of the composing disks divided by n. But enough about RAIDs.

If you have a serious physical drive failure be aware that unless you take a hammer to the drive you could still recover the data. Most hardware repair services will probably tell you that you need to scrape the drive and get a new one but I am sure that if you are willing to pay they will help you get your data back – this is hearsay, I have never used such a company. The main component that needs to be intact are the magnetic disks that even if wiped still have a trace of your files. If the electronic component fails you can fix it if you know what you are doing. However, never, absolutely never open the disk’s enclosure, even a tiny speck of dust can destroy your disk. So the simple rule to obey here is: don’t be a cheap skate, upgrade your disk drives, storage is cheap these days. Even notebook disk drives can be upgraded. You should be safe, disk drives don’t fail as much as you would think. And, of course backup your most important files. Sorry, physical failures are scary and recovery is probably expensive but probably not impossible.

Moving on to something that I do have experience with: logical disk failures. There are a few things that might happen and here’s how to deal with them.

1. Your partition gets corrupted, files go missing and such. The best thing you can do is use a proper file system repair tool. On windows use chkdsk – I am not aware of any other tool better suited for fixing NTFS/FAT32 drives. If your logical drive is beyond recovery for some reason – I feel this should be impossible but hey, nothing is impossible, then you need to get a data recovery software – I discuss this a bit further down. For Linux use fsck/e2fsprogs/whatever; ext2/3 is a solid file system. In Mac OS you have Disk Utility and the command line version – use it to fix up your damaged HFS+ partitions. There is one big problem though – how do you recover if the drive corrupted is your OS drive? Now, If you’re like me you have more than one OS and you can use your secondary OS to fix up your primary OS’s drive. You can even attempt to fix NTFS drives from Linux and Mac OS using ntfs-3g tools – not very healthy but it might do the job(better third-party tools are available for money). If however you don’t have another OS then you need to get yourself a boot CD and work your magic from there. For Windows just use your install disc and go to recovery mode and run chkdsk from there – Windows 7, if it can still boot, can do this without a disc inserted, by pressing F8 at startup and choosing recovery. Be aware that Windows has the annoying habit of reading all your disk drives when going into recovery mode – if one is damaged this could take very long to forever. If you are impatient try to use another boot CD like Hiren’s or maybe a Linux live CD. In my experience nothing fixes up a damaged windows drive like chkdsk. For Linux damaged disks just boot some live CD and fix it up, what else?

Warning: you might get some lost & found files when fixing a journaled file system like NTFS and ext2/3 – it’s all good, keep ’em or throw them away, it’s up to you.

2. You have messed up your partition table – whoops! You have accidentally deleted an important partition when installing another OS or using some stupid partitioning software or you have just erased the MBR completely(yes, I’ve done both – I can be a bit dumb at times). Don’t panic! Your data is still there. Don’t write absolutely nothing to the drive to maximize your recovery chances. Your files are still there, in fact if you would read your drive with a hex editor you could see the data. They are just “lost”, the OS no longer knows how to find them. If you erased your MBR completely and you have a backup of your MBR – which you don’t, who does that anyway, you can just rewrite it and all will be fine. If you don’t have a backup, most common case, you’ll have to recover your partition table. There are a bunch of tools out there that will do that but I believe the best is Acronis Disk Director Suite. The MBR can be rebuilt at times by analyzing the disk and finding out where the partitions were, what size they had etc. I am not aware of a free software that can do that, though – maybe that Easus thing. At this point you have to use disk recovery software (’cause you didn’t backup your MBR, that why!). If you can’t recover your partitions because you did something to the disk – maybe you wrote something to the disk and it’s MBR even though I told you not to – then you can just use a file recovery software to read the raw disk and reassemble your files. The best tool for the job that I am aware of is R-Studio for FAT and NTFS. I am unaware of a similar tool for ext2/3 but I am sure you can find one. This kind of software simply reads your entire disk and piece back your files – this is a time-consuming process but it saves your files, damn it! Sorry for all the unintentional product placement.

Again, remember not to write anything to your drive, should you delete your partitions, just use recovery software right away on it. This also applies to a situation where you simply and stupidly formatted a drive by mistake (dude, like how?) – same rules apply. Unless you used some wiping mechanism, files can still be recovered. Modern formatting software just marks the space as “free” not actually zero-ing out data so you’re safe even if you are the kind of person that formats their disks and then whines that your files are gone.

3. Should any combination of the first two occur, just use recovery data right away, don’t write anything to the drive! No 3 is actually completely unnecessary but good things come in threes, you know.

One last thing, when you are recovering files you are going to need some free space on another disk to write the recovered data. It would simply be disastrous to recover files to the same disk. By disk I mean a logical or a physical disk.

This is it. Should disaster hit you, don’t panic, nothing is as hopeless as it seems. In fact if you do panic you might do more damage than if you were calm and rational.

P.S.

In my Data Hell experience, I could never recover password protected RAR archives – not sure why that happens, they become corrupted after recovery. I must look in to that. I don’t use passwords anymore.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.