In the March 2012 issue of his newsletter, Mark Minasi discusses how he dealt with a failing hard drive, one with bad sectors*. His needs were simple and typical, just to copy off the files that were still readable.
The point of his article is that, with the right set of options, Robocopy can be used for this purpose. Fine. But, there are other, important, Defensive Computing lessons here.
The story started when Minasi noticed that his backup program was running all the time, something it's not supposed to do. What happened was that it could not read an area on the hard drive and, rather than give up, or put out an error message, it was re-trying the failed I/O over and over and over again.
Who would design a backup program that loops forever trying to read an unreadable sector? Microsoft. Minasi uses the backup program included in Windows 7.
I suppose this makes sense for him as he makes his living in the Microsoft world. But, the rest of us Windows users, should avoid backup software from Microsoft that has a long history of sub-par backup applications. And that's being kind.
The other extreme is also bad. That is, no one wants backup software that rolls over and dies the minute it hits a bad sector. That too, prevents you from backing up files that can be read.
The best option is skipping the unreadable sectors, a feature you won't find mentioned in a software review and something not likely to be in the features list for any backup application. So, articles like Minasi's are very helpful in pointing out software that is able to read what it can and skip what it can't. This can be a lifesaver.
There are two types of backup programs, those that copy files and those that copy hard drive sectors. The latter are referred to as disk image backups. Robocopy copies files, but Minasi also discussed image backups which are even more likely to encounter bad sectors.
According to Minasi, the image backup program in Windows 7 has no option to skip over bad sectors. The backup program that I use with Windows XP, DriveImage XML, does skip bad sectors. In fact, that's why I use it.
Years back, someone gave me a defective hard drive so that I might recover as much data as possible. The first thing I tried to do was make a full image backup. A couple imaging programs died when faced with unreadable sectors. But DriveImage XML reported the bad sectors and then let me skip over them. From then, until Windows 7 rolled out, it was my preferred image backup application.
Sadly, DriveImage XML didn't seem to transition well to the new start-up architectures in Vista and Windows 7. Now, I use Shadow Protect from Storage Craft. It's expensive, but it can skip bad sectors. The option is buried deep in the user interface, but it's there.
Mark Minasi is a smart, experienced guy. Yet his initial attempt at using Robocopy had some flaws.
First, he tries to move files from the failing drive to a new one. Why move? Once you know a hard drive is going bad, you should only try to read from it. He not only asked for trouble by writing to the drive, he slowed down the backup.
Speaking of speed, he created 10 threads to copy the files off the bad drive. Spinning platter hard drives are thousands of times slower than a computer, so its the computer that waits for the hard drive, not the other way around. Plus, a hard drive can only read or write to one cylinder at a time, no matter how many I/O requests are queued up for it, so there is little, if any, benefit to multiple threads.
And, backups should be as simple as possible. Ten threads leaves you open to possible bugs in Robocopy dealing with multiple threads. Why take a chance when you're already in a bad place?
Finally, if you think I was too hard on Microsoft, consider one last point about their Robocopy utility. Before Minasi found the parameter that tells it not to re-try failed reads, how do you think it worked?
Unlike the regular Windows backup, Robocopy does not re-read bad sectors forever. Nope, only a million retries per sector.
As Manasi put it: "Really -- I'm not kidding".