Restore a Corrupted Boot Drive with Time Machine

| How-To

If your Mac’s boot drive becomes badly corrupted and requires a reformat, one way to recover is to do a full restore from Time Machine. Here’s how my own adventure went, and included, free of charge, are a few hard lessons learned.

______________________

Our family server is a 2009 Mac Pro. It’s a great machine for serving up iTunes content, maintaining our photo archives, and many other things that I keep separate from the iMac I use for scouring the Internet and writing articles. However, last Monday night, disaster struck.

The Crisis

On October 1st, Data Backup 3 informed me that it found an error on the boot drive that needed to be repaired. Disk Utility confirmed:

Unfortunately, it was the kind of error that neither Data Backup 3 nor Apple’s Disk Utility could fix. Disk Utility recommended that I back up my files and reformat the disk. At first, I didn’t think this was going to be a major problem. However, after checking my Time Machine Preferences, I discovered to my horror, that my last TM backup was September 19th. I’d done some important work since then, and so I was starting to get nervous.

After some reflection, I realized what happend. That Mac Pro was the last Mac to get Mountain Lion, and I’d turned off TM on September 19th to do the upgrade. I forgot to turn it back on.

Yes, even the pros hose up once in awhile. No comments. please.

Saving the Day

The boot drive still booted, and the error message suggested that my current files were intact, so I decided to do a Finder copy of all file in my account. There were two reasons for that. First, I had done important work since September 19 that was not in the TM archive. Second, if for some reason the TM restore failed, I’d be up a Jacobian without a Determinant. In other words, screwed.

The nice thing about the Mac Pro is that is has a boatload of drive bays. I keep a 2 TB drive in one of the bays for my iTunes library backup, managed by Data Backup 3, and I also use the remaining 1.5 TB as scratch space, for just such an occasion as this. So I booted from yet a different drive (gotta love those Mac Pro drive bays) and started copying every folder/directory in my account from the corrupted boot drive to the scratch drive.

Armed with the Finder copy backup and a TM machine archive, I felt ready to reformat the boot drive. And I did. Then I realized my mistake.

Each update of OS X wipes out a command line setting to show the user’s Library folder. Sure, you can go to it easily. Sure, you can put it in the Finder side bar. But when it comes to seeing your home directory and doing wholesale Finder copies, out of sight is out of mind. So my current Library folder didn't get saved. Cough.

So here it is again. Do this terminal command after every OS X update. And for reference, here’s Ted Landau's quintessential article on the matter: "How to Permanently Restore the Visibility of Lion's User Library Folder."

(In the shell command below, replace "yourusername" with your account name, minus the quotes.)

chflags nohidden /users/yourusername/library 

This was a more serious mistake because it would likely hose up my iTunes backups of iPhones and iPads and any other important changes to my home Library folder since then. But there was nothing I could do. It was a beginner mistake born of not doing a full recovery very often, but Apple can take part of the blame for being to darned cute.

Yes, even the pros hose up once in awhile. Feel free to unload on me for that one.

Recovery

The next thing I did was to quickly take a look at an article at TMO that has been hugely popular: “Restoring a Full System with Time Machine,” from 2008. Regrettably, times have changed. The article is out of date and linked to a tutorial that no longer exists. 404 error.

So I began the process of reminding myself how to do a full restore from Time Machine.

The first thing I relearned was that if you install a new copy of OS X on the newly partitioned boot drive, then start up, you’ll be offered a chance to restore user files from a Time Machine archive. But here’s the gotcha.

The OS assumes that you have a new Mac or a least a good version of the OS, so all that gets restored is the user accounts and settings. The OS is not overwritten . Worse, I found that some critical settings I had did not not get restored. The restore got graded an “incomplete.” Oops. Think again.

A little more research showed that the right way to do this is to boot from the Lion Recovery partition that’s still on the boot drive, even after you repartition it.

You do that by holding down CMD+R and rebooting. The system still knows which drive to boot from, even if you repartitioned the main part of the drive. That sneaky Recovery partition is still intact. Again, you use Disk Utilities.

This time, when you opt to restore from Time Machine in the Disk Utilities, you’ll get a full restore, OS and everything, from the Time Machine archive. It looks like the shot below. (Note, OS X screen shots are not possible at this stage, so I used my iPhone's camera, probably too close, causing moire patterns.)

Next, you select a source, your connected Time Machine drive, and then select the date of the archive. It looks like this:

Finally, you’ll be asked to select a destination drive for the restoration. Then, you’ll see a progress meter as the complete system restore from the Time Machine archive is reloaded.

Mopping up

The final task was to boot from my emergency drive, as I had done before, and then copy the modified folders where work had been done since September 19 to the boot drive. I renamed several folders, like Documents to Documents-old, then copied over my saved folders from the scratch drive.

At this point, I felt that I had lost zero work and the Mac Pro was back to where it was on October 1st. I updated the boot drive to Mountain Lion (again), patched to 10.8.2, and installed iTunes 10.7. As expected, the fact that the Library folder was out of date created some headaches with iTunes, and that took another hour or so to straighten out. At one point, I was in an endless loop of authorization with the iTunes Store, but I got through it. That’s another story.

Finally, when I was confident all was well, I turned Time Machine back on.

Lessons Learned.

  1. If you turn off Time Machine for any reason, set a Reminder in OS X to turn it back on.
  2. Always explicitly display your Library folder. Always.
  3. Have a very large scratch drive handy for a Finder copy, just in case.
  4. Consider a periodic, second method of redundant backup. For example, Carbon Copy Cloner or Data Backup 3 to an external drive that’s kept safe somewhere else. (I keep mine in a safety deposit box. But my last excursion to the bank was too long ago.) An in-house version, updated every weekend isn’t a bad idea. A 2 TB external drive is not that expensive these days.
  5. Emergency data recovery is seldom done, and each new version of OS X introduces new wrinkles. So, it’s wise to build a full recovery checklist -- or at least bookmark articles like this -- and periodically conduct your own training drill. As they say in Karate class, “You have to die a thousand times in the dojo to live once on the street.”
  6. As in flight operations, a cascade failure of small events leads to a Big, Bad event.

There are some things I could have done differently. I expect to get a lot of flak and advice from all of you. I deserve it this time. So feel free to comment.  At least I don’t trust Time Machine to backup my iTunes library, and I’m pretty good about keeping my Time Machine archive up to date on all household Macs. But...

With just a few cascade errors, you can be cooked.

_______________________

Lightning image credit: Shutterstock

Comments

geoduck

No criticism here. We all slip once in a while. Remember that what you did 99.999% of the rest of the population could not even have attempted.

One thing though. Last spring the drive gave the same error on my MacBook. I did the restore like you did (I had a recent enough TimeMachine backup so that was good enough). The thing was that the drive failed again, this time terminally within a month. This has been my experience with drives the last few years. They work flawlessly but when they fail they’re done.

Keep the backups going. You may very well be replacing the drive before Halloween.

cb50dc

No criticism at all. In fact, I’ve got nothing but thanks for your being willing to give us all the details it took to get through it. I’ve saved this page as PDF for a just-in-case.

Fern

Just one thing though - check your time capsule back up isn’t also corrupted. This happened to me, I ended up having to pay for data forensics to rescue all critical data.  A very expensive exercise.

John Martellaro

Fern.  Yes, indeed.  That fits in very nicely with Lesson Learned #4 in the article.  I can’t recall how many times I’ve heard stories about oblivious backups of corrupted data, going back in time, until there were no valid backups left in the archive.  Time Machine isn’t always flawless, so a second method is advisable.

furbies

From time to time, we all Err. Otherwise we’d be computers…

So DiskWarrior couldn’t fix the error, or at least allow you to copy off your data?

And now and then it’s worth while using the Finder to have a wander around inside your Time Machine HDD. And don’t forget to look through old backups.
If nothing else, it’s a trip down memory lane…

Richard

“Even the best laid plans…”

Hard drives have a finite life. I would think a better plan would be to have three bootable backups in addition to the Time Machine or Time Machines. One in the bank, one on or in the MP and one in a fire safe at home. There are just too many stories about total loss of data from causes that seem so bizarre that “you couldn’t make up stuff like that”.

If the working drive fails and you did not notice either a problem with the backup drive or the backup you just did turns out to be corrupted also, things can go from bad to worse in a hurry.

Yes, its a pain keeping things up.

And sometimes it is just a software screwup, like Entourage taking a dump for no apparent reason.

iJack

Thanks, John.  I have assumed that my internal iMac was dead for a couple of months now, in spite of Disk Utility telling me otherwise, so maybe this is worth a shot.

I’ve been operating off a pair of external 1TB drives, each with three partitions.  The 2nd drive is entirely for backups:
- Daily SuperDuper everything
- 3 days /week SuperDuper media (from a separate partition on the 1st drive)
- Hourly Time Machine.

I sleep most nights, and maybe even better now that I have also saved this article as a PDF.

vpndev

Remember that Time Machine now will back up to multiple destinations.

I too have a Mac Pro with a TM drive in one of those many bays. But every few days I plug in a 1.5 TB portable and let TM back up there. And then put that drive away elsewhere. Same Idea with the MacBook Pro - two TM drives.

farmboy

A true cautionary tale.

I have to agree with Geoduck, in the last few years it seems that drives function perfectly…until they don’t, and then they’re simply unsalvageable, even with Data Rescue, Disk Warrior, Disk Utility, etc.  Multiple backups in multiple locations is the way to go (cloud storage doesn’t work for us for security reasons).

Log-in to comment