10.5: Improve networked Time Machine performance
May 13, '08 07:30:00AM
Contributed by: beba
After using a 500GB Time Capsule for Time Machine backups for awhile, I noticed increasing duration of the backups. Mainly the prepare and post-processing phases, and transfer of large number of small files, took a lot of time. For the transfer of large files, the slowdown was not so noticeable.
I inspected the sparsebundle disk image on the Time Capsule, and inside the disk image bundle of about 150GB, I found nearly 20,000 band files of 8MB each in a single folder. These 20,000 data pieces contain the data of the backup image. When Time Machine reads, creates or deletes folder structures in the backup image, the operating system must randomly access data distributed over these 20,000 band files. And that causes a remarkable amount of additional administrative accesses to the AppleShare volume of the Time Capsule.
I decided that a better size of the bands of the backup sparsebundle disk image is 1GB, i. e. my 150GB backup would contain about 150 band files in one folder. I converted the Time Machine backup image with the following method, which will also work fine for an AirPort-connected hard drive, not just for a Time Capsule.
[robg adds: Note that the following solution is clearly not Apple-approved, and there may be very good reasons why Apple chose an 8MB band size. If you're going to try this hint, realize that you're potentially endangering your backups. With that said, I've noticed the same performance issues on the USB-connected hard drive on my AirPort Base Station, so I'm going to try this later today to see how it goes. (I use this disk for backups of our laptops, neither of which contain critical can't-lose information, so it's a relatively low-risk test.) Read on for the proposed solution...]
Before you begin, note that this hint requires that the Time Machine disk has enough free space to hold another copy of the backup disk image.
- In the Time Machine System Preferences pane, turn off Time Machine.
- To be on the safe side, make a backup of the Time Capsule to a USB disk attached to the Time Capsule using the AirPort utility. (This takes some hours.)
- Attach the Time Capsule to your Mac via Ethernet because it is much faster than AirPort.
- Mount the Time Capsule disk in the Finder.
- Open a Terminal window and change to the root of the Time Capsule disk (named TimeCapsule in this example): cd /Volumes/TimeCapsule
- In this directory, you'll find the backup sparsebundle disk image, which is a folder with the name and the MAC address of your Mac with the suffix .sparsebundle, e. g.: MyMac_001acb9cb23d.sparsebundle. In this folder, you find a folder named bands that contains the many 8MB band files. You can see them with this command: ls -l MyMac_001acb9cb23d.sparsebundle/bands. Note that it will take a while for Terminal to show the list of bands, as there are so many of them.
- Convert this disk image with the hdiutil tool to a new one using a 1GB band size:
hdiutil convert MyMac_001acb9cb23d.sparsebundle -format UDSB -tgtimagekey sparse-band-size=2097152 -o NEW_MyMac_001acb9cb23d.sparsebundle
This will take quite a while -- hours -- to run. (In case you're curious, parse-band-size is set to 2097152 because 2 * 1024 * 1024 512-Byte-Blocks = 2097152 = 1GB band size.)
- When the conversion finishes successfully, exchange the two images by renaming them (you can do this in the Finder, too):
$ mv MyMac_001acb9cb23d.sparsebundle OLD_MyMac_001acb9cb23d.sparsebundle
$ mv NEW_MyMac_001acb9cb23d.sparsebundle MyMac_001acb9cb23d.sparsebundle
- Eject the Time Capsule disk and disconnect the Ethernet cable.
- In the Time Machine System Preferences pane, turn Time Machine back on.
Now notice that the Time Machine backups are (hopefully) running a little bit faster than before. When you are happy with the new backup disk image, later delete the OLD_MyMac_001acb9cb23d.sparsebundle image.
CAUTION: If anything goes wrong, you may destroy all of your Time Machine backups! And there is no guarantee that the converted backup disk image works fine in the future, i. e. when the Time Capsule fills up, or when Apple changes the Time Machine software. Apply this hint on your own risk.
Comments (8)
Mac OS X Hints
http://hints.macworld.com/article.php?story=2008050913104691