As much as I love Apple’s Time Machine, it’s a hard drive pig. If not carefully watched, the little porker will use every spare byte of free space it can. What is particularly obnoxious, however, is that you might not realize you have a problem until it is too late and you’re backup drive is filled to capacity.
Take my situation as an example. I have a single MacBook Pro notebook with a 250 GB hard drive. Most of my files are text based and on the smallish side. In comparison, my networked backup is a hefty 1.5 terabytes. The combination of small hard drive and large backup drive had me thoroughly convinced that I wouldn’t have to worry about free up space for years.
I was wrong.
Because of the size of the backup drive, I like to keep other files on it – mostly music and video files – so that I have a duplicate copy. But earlier this week, I got a nasty surprise while trying to add an album I had just downloaded from Amazon Mp3. The Mac informed me the backup drive was full.
As you might guess, I found this to be very confusing. How could the drive be full? Sure … I had three or four hundred gigabytes of music and video files on it, but there was no way that the Time Machine backup could be over a terabyte in size … Could it?
This situation didn’t smell right, so I decided to investigate. I mounted the backup drive and tracked down the Time Machine sparsebundle and confirmed the impossible. My Time Machine Backup was a whopping 1.15 terabytes worth of disk space. “How in the world could the backup be so large?”, I asked myself. “Time Machine is supposed to be an incremental system. 1.15 terabytes is big enough to hold every bit and byte on my computer four and a half times over!”
First, I got annoyed; then, I got angry. What really tipped the scale toward seething fury, however, was failing to find any straightforward way of getting the space back. Yet another spectacular example of Apple’s “simple over useful” approach to computer design!
After the first bout of obscenities, I came to a simple conclusion: I could publicly express my dissatisfaction with Apple’s product line or I could go about trying to find a solution. Publicly spouting off was unlikely to help much, so I opted for the latter option. What follows is a brief summary of what I learned.
The Technical Details
The good news is that you can reclaim your drive space. It’s not even very hard. Here’s what you need to do:
- Delete any and all unnecessary backups from the sparse bundle image. Time Machine is tremendously aggressive in making sure that you’re protected and while this might make sense for the near past, do you really need that backup from 9 months ago?
- Mount your AirDisk, Samba share or Time Capsule as a local drive.
- Use the hdiutil to compact the sparse bundle.
Step 1: Delete Backups from the Sparse Bundle
Start by loading Time Machine from the root of your main hard drive. (In my case, the hard drive is named “RobOakes-Mac”.) Next, select the snapshot that you are interested in deleting from the timeline at right. Finally, press the gear button and select the “Delete Backup” option.
Time Machine will ask if you want to proceed. Confirm that you do, indeed, want to permanently remove the selected backup by pressing the “Ok” button.
At this point – if you’re using Snow Leopard – you may run into a rather obnoxious bug. For reasons that make little sense, the confirmation dialog box doesn’t always appear. Instead, the user interface might freeze and you’ll be treated to the spinning beach ball of death. If this happens, be patient. It might take a minute or two for Time Machine to go about it’s business. (Since this problem doesn’t exist on regular Leopard, go ahead and curse Apple’s grandiose, false, and self-serving rhetoric about parallelism. It might even make you feel better, I know it helps me.)
When the damn beach ball finally goes away, just hit enter. Apparently, the dialog box really is there, you just can’t see it. So, use your imagination and pretend.
Finally, you will be prompted to enter an administrator password.
When you’re all finished deleting snapshots, click on the main “Cancel” button. This will take you back to your desktop.
If everything worked as planned, you should see something similar to the screenshot below. There will be a “Delete One Backup” indicator for each of the backups you removed. Important: Wait for the indicators to finish before proceeding to the next step.
Step 2: Mount the Disk Using Finder
Since we will be using a command line utility to compact the sparsebundle, you will need to mount your backup disk before proceeding. While this can be done a variety of ways, the easiest is to open up the finder and select the backup drive from the list under “Shared”. (When it is mounted, you will see a little eject symbol next to the computer name.)
Now open up a command line terminal and go to the /Volumes/ folder.
Spend a bit of time looking in the various subdirectories until you find the correct .sparsebundle file. The sparsebundle file will have the general form of Computername_MACaddress.sparsebundle. Note the name of this file, it will be important in Step 3.
Step 3: Use the Command Line to Shrink the Sparsebundle Image
Once you’ve found your sparsebundle, use the following command to reclaim your free space (be sure to replace SparsebundleName with the name of your sparsebundle):
hdiutil compact SparsebundleName
Depending on just how your fat your Time Machine backup has gotten, this might take anywhere from a few minutes to a few hours. Regardless, the good news is that it works! After aggressively cutting away old backups, I was able to get my 1.15 terabyte porker down to a much more reasonable 500 gigabytes.
“An Ounce of Prevention”
While the procedure described above will let you fix the problem, it is far from an ideal solution. For starters, it’s only a temporary fix. Time Machine still has a gluttonous appetite for space and you’ll need to repeat the above steps whenever you want some of it back. For me, that works out to every six months. Further, the procedure is time consuming. The obnoxious ui freezes, spinning beach balls, backup deletions, and sparse bundle shrinking requires more time than anyone should have to spend on this problem.
This is a clear case of “an ounce of prevention is worth a pound a cure.” Rather than resorting to digital liposuction, it’s much better to simply limit how big the sparse bundle can become. This is no more complicated than using the “-size” flag when you create it. But if you (like me) overlooked that small step, then welcome to the club. Let’s just hope that Apple implements a more intelligent way to managing Time Machine backup size in the relatively near future!
- Backup, Sync and Share – Part 4: Apple Time Machine and Samba
- How to Scrub a PC Hard Drive
- Backup, Sync and Share – Part 5.2: Windows Vista Backup (Disaster Prevention)
- Time Drive 0.2 – A “More S” Release: More Stable, More Secure, More Settings and Now Supports Amazon S3 Storage
- Backup for Linux, Done Right - Part 2: Time Drive 0.1