Showing posts with label sysadmin. Show all posts
Showing posts with label sysadmin. Show all posts

Sunday, 14 December 2008

Can I restore a trashed disk using a wireless Time Machine backup?

Mark Wheadon made an interesting comment on my Wireless Time Machine post the other day. He wanted to know if it would be possible to restore a trashed Mac from a wireless SMB Time Machine backup by pointing the OS X DVD Disk Utility at it.

I don't think this would be possible (please correct me if I'm wrong -- I'd really like to know), as using an SMB network share relies on setting the TMShowUnsupportedNetworkVolumes system preference. This is turned off by default and I suspect impossible to change when you've booted from the OS X DVD.

Instead, the approach I take is to have two separate backups -- one a full disk backup that just clones the entire disk; and separately, a wireless Time Machine backup.

The cloned disk backup is great when your disk dies, especially if you use similar hardware to the actual disk in your machine: if you get a failure, simply swap the hardware and carry on. I use Carbon Copy Cloner to make my cloned backup -- it's free, it's certified and it has an option to start automatically as soon as you attach your backup drive. Combine this with a 2.5" SATA disk in a USB enclosure and you have a drive ready to take the place of your MacBook's internal drive within a couple of minutes.

However, making a clone requires you to attach a physical drive, something that is too easy to forget doing regularly enough. It's almost guaranteed that the one day you forget to clone your disk is the one day your disk crashes irretrievably... This is where the wireless Time Machine backup comes in. Once you've got it set up, all you have to do is leave your Mac turned on and attached to your WiFi and you will get regular backups of your recent files (up to once an hour if you want).

So the answer to Mark's question would be that if my hard disk crashed, I would swap it out with the clone and copy any recent files from my Time Machine backup. This would deal with the immediate term -- generally the most crucial time when you have a disk crash. I could then look at restoring any other files I need from Time Machine at my leisure, though I would take a clone of the clone as soon as physically possible. I might also turn off Time Machine temporarily so that the out of date clone doesn't use up unnecessary space on the backup image -- but this would have to be a choice based on how long before I'd switch to using the clone as my main drive.

I'm not sure whether it's possible to use Disk Utility's Restore function from a Mac that has the TMShowUnsupportedNetworkVolumes preference set to true. Has anyone tried?

Friday, 18 July 2008

Time Machine fails on 10.5.4 when interrupted by sleep

Ok, so I've been using my QNAP TS-109 NAS box as a remote Time Machine server for my various home Macs for several months now. Everything's been going swimmingly and for the first time in years I've felt a little more secure knowing that my files are all backed up to several generations, without me having to do anything.

However... in the last couple of days, first one then another of the backups failed and wouldn't restart. The symptoms were Time Machine errors saying that the target volume was read-only.

I ran a couple of quick checks -- first seeing if I could open the sparse bundle used for the backup image directly and try to repair it using Disk Utility -- but it wouldn't even mount. Then I checked in the logs to see exactly what happened when.

It turns out that in both cases, the backup failed when the machine was put to sleep during a Time Machine run. When the Mac woke up, it tried to automatically reconnect to the SMB share and logged a failure message such as the following:

Jul 16 15:34:48 imac kernel[0]: smbfs_smb_reopen_file: Reopen 2b with open deny modes failed because the modify time has changed was 1216197810s 0ns now 1216197813s 0ns!

These messages were often succeeded by various other disk errors and culminated in the backupd process returning an error when it was trying to do something. I have two examples of the backupd failures:

Jul 16 15:34:53 imac /System/Library/CoreServices/backupd[72423]: Error -47 deleting backup: /Volumes/Backup of iMac/Backups.backupdb/iMac/2008-07-15-084358

and

Jul 17 21:42:05 ruth_macbook /System/Library/CoreServices/backupd[6543]: Error: (-50) copying /Users/ruth/Library/Calendars/Calendar Sync Changes to /Volumes/Backup of Ruth's MacBook/Backups.backupdb/Ruth's MacBook/2008-07-17-211219.inProgress/A11E4033-1FAB-457A-96FA-B23B3FED2579/Macintosh HD/Users/ruth/Library/Calendars

but both appear to be due to the smbfs error above.

I've also just recently upgraded all my machines to 10.5.4. Given that it's quite unlikely that two machines would start to fail so close to each other, I suspect that the latest OS upgrade may have introduced a bug.

Other people seem to have encountered similar issues, and not only with unsupported NAS boxes but with official Time Capsules too.

I tried attaching the backup image without mounting it and then running Disk Utility (as suggested here), but Disk Utility wasn't happy then either -- giving me "sibling link" errors. Running fsck by itself just results in "BAD SUPER BLOCK: MAGIC NUMBER WRONG" which is kind of worrying. I haven't yet tried using DiskWarrior, though it's probably worth the $99 for some peace of mind.

I'm going to try a couple of things next:

  1. Check the NAS disk itself for corruption, just in case.
  2. Buy DiskWarrior and see if that fares any better.

I guess after that, I may have to wipe the backup and start again. At least it's a backup and I don't need anything from it right now (famous last words...).

A few days later...

The NAS disk itself seems fine -- I successfully backed up to another image on the same disk with no trouble.

I bought DiskWarrior and ran it against one of the corrupted backup images, but this didn't work either.

Please post a comment if you've had something similar happen to you. Especially if you've been able to fix things!

What I have noticed is that the Time Machine Options (under the Time Machine Preference pane) has a checkbox labelled "Back up while on battery power". Since I only tend to put my machines to sleep when they're on battery power, avoiding backups completely during this time should avoid this corruption issue for the moment.

Backups are now going fine again, just not on battery power.