Showing posts with label smb. Show all posts
Showing posts with label smb. 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.


Sunday, 6 April 2008

Time Machine Update Fixes Sparse Bundle Handling

So in my previous posts I documented how I’ve got Time Machine working nicely on my QNAP TS-109 NAS box, with several Macs all backing up to it wirelessly. My last niggle was that Time Machine didn’t handle the case when it ran out of space on the backup — it’s supposed to thin out hourly backups older than a day, daily backups older than a week and weekly backups as needed. The problem was that when it deleted old backups from the sparse bundle on my NAS box, the sparse bundle didn’t update the amount of free space. Consequently Time Machine went on deleting old backups to make room until there were none left. Not a good solution…

However, Apple recently released Time Machine and AirPort Updates v1.0 which I gingerly tested out in case they’d decided to specifically turn off SMB backup support. To my surprise, the sparse bundle space problem has been fixed!

Here’s the log from my console showing how the disk space increases each time a backup is removed — you can see that Time Machine now ejects the sparse bundle after each deletion, reclaims the space properly and then tries again. In case you’re wondering why it’s saying it needs to backup 53GB (and what those “Event store UUIDs don’t match for volume” and “Node requires deep traversal” messages are), don’t worry — I just replaced my internal hard disk with a bigger one so Time Machine has to back up everything starting from scratch. This is a bit annoying as I’ve cloned the data to the new hard disk, but I suspect that any backup software would have a similar problem.

06/04/2008 15:28:19 /System/Library/CoreServices/backupd[4015] Starting standard backup 
06/04/2008 15:28:20 /System/Library/CoreServices/backupd[4015] Mounting disk image /Volumes/Backup/Adam's MacBook_0017f2f0fd0f.sparsebundle 
06/04/2008 15:28:24 /System/Library/CoreServices/backupd[4015] Disk image mounted at: /Volumes/Backup of Adam's MacBook 
06/04/2008 15:28:24 /System/Library/CoreServices/backupd[4015] Backing up to: /Volumes/Backup of Adam's MacBook/Backups.backupdb 
06/04/2008 15:28:32 /System/Library/CoreServices/backupd[4015] Event store UUIDs don't match for volume: MacBook HD 
06/04/2008 15:28:32 /System/Library/CoreServices/backupd[4015] Node requires deep traversal:/ reason:kFSEDBEventFlagMustScanSubDirs| 
06/04/2008 15:39:44 /System/Library/CoreServices/backupd[4015] Starting pre-backup thinning: 53.57 GB requested (including padding), 9.90 GB available 
06/04/2008 15:39:44 /System/Library/CoreServices/backupd[4015] No expired backups exist - deleting oldest backups to make room 
06/04/2008 15:40:22 /System/Library/CoreServices/backupd[4015] Deleted backup /Volumes/Backup of Adam's MacBook/Backups.backupdb/Adam's MacBook/2007-12-20-172543: 9.90 GB now available 
06/04/2008 15:55:15 /System/Library/CoreServices/backupd[4015] Deleted backup /Volumes/Backup of Adam's MacBook/Backups.backupdb/Adam's MacBook/2007-12-31-005523: 9.90 GB now available 
06/04/2008 15:55:15 /System/Library/CoreServices/backupd[4015] Deleted 2 backups: oldest backup is now 8 Jan 2008 
06/04/2008 15:55:15 /System/Library/CoreServices/backupd[4015] Stopping backup. 
06/04/2008 15:55:22 /System/Library/CoreServices/backupd[4015] Backup canceled. 
06/04/2008 15:55:33 /System/Library/CoreServices/backupd[4015] Ejected Time Machine disk image. 
06/04/2008 15:55:33 /System/Library/CoreServices/backupd[4015] Compacting backup disk image to recover free space 
06/04/2008 16:17:46 /System/Library/CoreServices/backupd[4015] Completed backup disk image compaction 
06/04/2008 16:17:46 /System/Library/CoreServices/backupd[4015] Starting standard backup 
06/04/2008 16:17:47 /System/Library/CoreServices/backupd[4015] Mounting disk image /Volumes/Backup/Adam's MacBook_0017f2f0fd0f.sparsebundle 
06/04/2008 16:17:52 /System/Library/CoreServices/backupd[4015] Disk image mounted at: /Volumes/Backup of Adam's MacBook 
06/04/2008 16:17:52 /System/Library/CoreServices/backupd[4015] Backing up to: /Volumes/Backup of Adam's MacBook/Backups.backupdb 
06/04/2008 16:17:59 /System/Library/CoreServices/backupd[4015] Event store UUIDs don't match for volume: MacBook HD 
06/04/2008 16:18:00 /System/Library/CoreServices/backupd[4015] Node requires deep traversal:/ reason:kFSEDBEventFlagMustScanSubDirs| 
06/04/2008 16:29:18 /System/Library/CoreServices/backupd[4015] Starting pre-backup thinning: 53.57 GB requested (including padding), 12.75 GB available