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

15 comments:

Anonymous said...

Hi. Just wanted to say thanks for these posts. I'm not trying anything nearly as complex, just wirelessly backing up using Time Machine to a firewire disk attached to an old mac, but what I read here gave me confidence and the pointers I needed. Backing up (slowly) as I write.

If I document my experiences I will include links to here.

Onno said...

Hi, I can't tell you how relieved I am after reading your mail. After spending a lot of money on the ReadyNAS NV+ I was shocked to find out that Time Machine didn't find my shares in the network.
Searching for a workaround took five minutes (the commandline 'showunsupported disk' thingie) but also showed the warning of TimeMachine deleting all backups when the disk fills up. So effectively becoming a worthless solution.
My only hope was that most articles/blogposts were quite old, so I kept searching until I ran across your post.
Now I dare take the step of starting TimeMachine.
One question though: My NAS supports both SMB and AFP. My guess would be that AFS works slightly better for Mac, but your solution only mentions SMB.
Any thoughts on which file protocol to use?

Adam Cohen-Rose said...

@john -- thanks for the feedback! I'm glad to have been of help. You might want to answer Valentin's comment when you get things working.

@onno -- I used SMB 'cos I had trouble getting my QNAP TS-109 to serve AFP properly. I think that AFP may be slightly faster and possibly slightly more secure as well, but it shouldn't make any difference to the way that Time Machine works across the network. Good luck and post back when you have it working!

Onno said...

Hello Adam,

so far no succes. Time Machine starts, it creates the backup file, but then stops with an error message about not being able to create a backup.
Using the admin account on the NAS and shutting down Parallels didn't help.
The only cause I can think of now is that both SMB and AFP are running on the ReadyNAS.
Will keep you posted.

Adam Cohen-Rose said...

@onno -- you've hit the problem with creating an initial Time Machine backup from 10.5.2. Read my previous post for one way round the issue. Some people have commented with other solutions.

Onno said...

Found a walkthrough that doesn't need a second Mac. The sparsebundle is created commandline.
Don't have time to go through it now, but will let you know when I did.
Here's the link:
http://www.readynas.com/?p=253

Onno said...

Hello Adam,
it works!
created the sparseimage from the comandline, copied it to my share and pointed TimeMachine to that share.
It's now backing up.
Stopped the backup and switched from WiFi to gigabit ethernet, but surprisingly that seems to be slower that WiFi 802.11n?! about 2MB/s instead of about 5MB/s...
Will leave it running while I go to sleep.

But something completely different: do you know of anybody having experience building a mobile app on top og Google Maps Mobile?
mail me at onno at terwisscha.com if you do.

Anonymous said...

I have a fairly NEW MacAir. I used it in my offices where we have a few wireless nodes to allow access all over the property. With my new Air, I also got a Time Capsule. I thought I setup the Time Capsule with Time Machine, correctly, but I noticed a few times, on the little dialogue box, that it was trying to backup almost 100 GB of data?!?! I just ignored it and let it do it's "Magic", thinking my NEW RELIABLE MAC AIR would never need a restore anyway. I would sometimes sit at the desk near the Time Capsule (presumably on it's network) for a few hours and then leave the area with my Air, to return again later for minutes, hours and more. I noticed sometimes it would try to perform a backup while I was BUSY with other stuff and I would click cancel, figuring that it would bounce back to where it left off later, as the system is advertised. 4 days ago my Air lost everything. I went to the Apple store for an exchange and took the time capsule with me, hopefull they would make my new one an exact clone of my other one, which I had spent dozens of hours customizing, etc PLUS had thousands of files exclusively stored on it. The tech said there we no backups on the time capsule??? I brought both back and installed Time machine on a PC in the network and found 3 FOLDERS, one a "parse" folder. Using the migration feature on bootup of the new AIR didn't work after several attempts, it couldn't :"find": any back ups??? I looked at the folders on the PC and one folder has almost 98 GB's of files and over 100MBs in the others. I moved these folders to the HrdDrive on the new Mac Air, but when I try to click on them (hoping it would launch some sort of uncompress app or something), it says" WARNING: Image: Appled MacBook_00163782389271.....tmp.sparsebundle"Reason: "Operation not supported" That one file is 68.1 MB, and it say's under "kind", on the general info tab: "Sparse Disk Image Bundle". Can these be used in this form at all? I still have the "files" and would LOVE to get my new Air back to where the "old one" (4 weeks old), was. Ideally, I would LOVE all settings, software, applications, customizations, etc to follow, but at the VERY least, the documents, music, images, pictures, spreadsheets, word docs, etc would be very useful. Any ideas on what I can do here?? ANY HELP IS APPRECIATED! michaellaguna74@yahoo.com

Trurl said...

I have a Mac Air that I've been backing up wirelessly to a disk in a remote machine. All the files are in a sparse bundle on that machine. If I connect to the disk on that machine in the Finder and double click on the sparse bundle, it gets opened and shows up as a disk under the "Devices" heading in my Finder windows. Inside this "disk" are directories containing my backups for different days and hours.

If you're having trouble opening the sparse bundle, you might try doing it in Disk Utility: click on it in the sidebar and then click on "mount". You might need to repair the "disk" before mounting, or there may be a permission issue, or try Googling for your error message.

But you shouldn't have to figure this out. If the files are there, a "genius" at the Apple store should be able to make this work. Try a different person than the last time. You may have just found someone who didn't know what s/he was doing. Maybe the last backup that was done got interrupted and Time Machine is confused by the final partial backup (fix: delete the last backup). There are all sorts of possibilities if there is actual data there.

Anonymous said...

Hi,

I've just started playing with this using my ubuntu box at home as an SMB server. The first thing I noticed was that different web sites have slightly different recipes. The variable bits seem to be whether the disk image is created "case sensitive" or not, and whether it has spotlight indexing enabled or not.

I also tried creating an encrypted image to see if I could get that to work - I couldn't.

The one issue I have come across is that the mac doesn't seem to unmount the smb share before it sleeps. If the machine is able to contact the server on wake there is no problem. If not, then I get an error on wake. Any suggestions?

Arjan said...

So, after the "compaction" your drive still needed more space, right? The last line shows "Starting pre-backup thinning: 53.57 GB requested (including padding), 12.75 GB available" so I assume Time Machine kept deleting old backups and compacting the sparse bundle, until enough space was freed?

I wonder if Time Machine always removes a few old backups before trying to compact. In my case, I noticed some huge files that partly were already removed from expired (daily, weekly) backups and partly I removed from the backup myself. Manual compacting reclaimed 200 GB on a 300 GB disk! In this case, any pre-backup thinning without compacting first, would have removed some history while in fact that should not have been required...

Of course, Time Machine is still a backup, not a version control system, so losing some old backups is not a real issue.

theosib said...

I just wanted to mention that putting a notebook to sleep while it's backing up to a SMB share can cause corruption to the sparsebundle.

There's a solution to that on this page:

http://www.macosxhints.com/article.php?story=20081115172028293

What this fix does is cause the backup volume to be safely ejected when you put the computer to sleep.

Adam Cohen-Rose said...

thanks @Timothy. @Kevin mentioned the SleepWatcher solution after I posted having exactly the same issue. I've currently got the "Back up while on battery power" checkbox unticked and use TimeMachineEditor to only backup overnight anyway.

Jed said...

Thanks for this post; very helpful. I have the same issue you were facing (got a new internal hard drive, now Time Machine wants to back up the whole thing but doesn't have space and so wants to delete the oldest backup), but I didn't let it run long enough to give it a chance to compact; now that I know it's safe to do that, I'll try it.

I agree with Arjan that it really ought to try the compaction *before* deleting the oldest backup. So I may try compacting manually with hdiutil compact. But I'm a little hesitant to do that; I may just let Time Machine do its thing.

(I've also deleted a bunch of unnecessary backups manually, using the Time Machine GUI for doing that, so I suspect the sparsebundle has a lot of reclaimable space.)

Unknown said...

You don't really have to start over from scratch when you change to a larget Time Machine NAS. Simply do this:

- Change the back location to the new place, and start a backup, wait a bit and cancel it
- Mount the original sparse bundle and the new one.
- Use Disk Utility or Carbon Copy Cloner to do a block-level copy from source to the destination (make sure you choose the correct source cuz the names are the same!!!)
- Wait thru the copy and verification steps
- Detach your old Time Machine device
- Try opening Time Machine and browse for your backups. If it succeeds, your are done. Simply resume the ordinay backup function and you won't start from scratch.

Same thing applies to when you change your Mac OS hard drive. Make sure you do a block-level partition copy, not a file-level, otherwise it will force a full backup in Time Machine again, and it can be very painful.