How Time Machine Works its Magic

How Network Backups are Stored in Sparse Bundles

Previous      Frequently Asked Questions        Works Overview      Troubleshooting       Contact     Next   

 

Previous      Frequently Asked Questions        Works Overview      Troubleshooting       Contact    Next   

The normal Backups.backupdb folder used to store local backups (see How Local Backups are Stored) can't be placed and used directly on a network drive. 

When backups are made over a network (Ethernet or wireless), the Backups.backupdb folder is placed inside a rather odd container called a sparse bundle disk image.  A disk image is kind of like a disk-within-a-disk -- it has its own format, directories, etc.  Thus the format may be different from the format of the disk it's on.   See the blue box below for more details.

Unlike backups made locally, there's a separate sparse bundle for each Mac, named for and identified to that Mac.  You can see the sparse bundle(s) via the Finder -- connect to the server, then click on the disk/partition name (Finder in Column View):


                                                                

The Time Capsule's internal HD is named "Data" by default (you can change it via Airport Utility).  Any other drives connected to it will also be shown (such as "S. Misc3" in the sample). 

The names of the sparse bundles start with the name of the computer that was backed up, but vary a bit depending on how they were created, but most look like the first one in the sample.  But ometimes there's a 12-digit address as in the second one, and sometimes the .sparsebundle suffix isn't shown, as in the first.

To see the backups in the disk image, double-click the sparse bundle via the Finder to mount the disk image inside it.  That will take a moment;  then the disk image (usually named Time Machine Backups, but sometimes Backups of <computer name>), will appear in the Finder sidebar and/or desktop (circled in green in the sample):


                                                                

Double-click the disk image to open it.  Then you'll see the same Backups.backupdb structure as with local backups.

The sparse bundle also contains some identification and control files (different versions of OSX will have slightly different contents), plus a very large number of files in the bands folder -- your data (including the usual directory structure) is actually spread over them.

 

What the heck is a sparse bundle disk image?

OSX allows you to create and manipulate various types of disk images, via Disk Utility. 

It may be formatted differently than the format of the volume (physical disk or partition) it's on, and has its own set of directories, Spotlight index, trash folder, etc., plus, of course, any data you put there.

To do anything to the contents (view, add, change, or delete files or folders), you must first "mount" it, usually by double-clicking it via the Finder.   Unlike a normal volume (disk or partition), only one user may do that at a time.

There are two main differences between the types:

  1. When most types are created, you specify a size, and that amount of space is immediately assigned to it.  That can take a long time, especially if it's created over a network.  Thereafter, it cannot be expanded or contracted -- it remains a fixed size.

  2. When not mounted, all types except sparse bundles are treated as a single file.  That means, if you mount it, change a single tiny file, then unmount it, the entire disk image is treated as changed, so any backup app (such as Time Machine or a "cloning" application), will back up the entire contents. 

  3. But when you create a sparse bundle disk image, you specify a maximum size.  The actual contents start out very small (just enough for the control files, empty directories, etc.).  As you add to it, the actual size grows until it reaches the maximum.  While it's possible to change the size later, Disk Utility must do a Verify Disk as part of the procedure, so it can take a very long time, especially over a network.  See Troubleshooting item #A8 for details.

  4. Sparse bundles, however, have that "bands" folder in the sample above.  All the directories, etc., plus the data, is spread over the "band" files inside it.  Only the new or changed band files are considered as changed, so they're the only ones that get backed-up.  On a large disk image, that can save lots of time and backup space.

  5. The downside is, when things are deleted, the disk image doesn't shrink automatically.  The vacated space is re-used for new data, then the disk image will grow again.  There is a UNIX command to "compact" a sparse bundle, that will recover most of the empty space.  That's the first thing Time Machine does when it's out of room.  You can do it yourself if necessary;  see the pink box in Time Machine FAQ #12 for instructions.

Normally, disk images of any type are not backed-up while mounted, as they're considered as open.  They only get backed-up when not mounted.  (However, Time Machine does show them as included in the backup, but with the contents of the last time they were actually backed-up.)

To see the control files in the sparse bundle, select and control-click it, and choose Show Package Contents (Finder in List View):


                                                                

Do not attempt to change anything in those control files;  that can destroy your backups.  Among other things, they contain the hardware address of the Mac that was backed-up.  The sample is from Mountain Lion;  older versions of OSX don't have all the files shown above.  Leopard, for example, has only the last 3.  Sparse bundles used for other purposes will have some differences.

As detailed below, unlike a normal folder or disk image, when a file in a sparse bundle is changed or deleted, the space in the band folder(s) remains as part of the sparse bundle -- the size of the sparse bundle doesn't change.  That space is re-used for new files, though, so the sparse bundle won't grow until all the vacated space is used, and new "band" files are added.   There is a UNIX command to "compact" the sparse bundle, which Time Machine uses when there isn't enough room for new backups.  You can also do that manually, if necessary.  See the pink box in Time Machine FAQ #12 for instructions.