How to Mount a Sparsebundle Disk Image from Time Machine Backup?

I have several sparse bundle disk images on my system, used for various purposes (mostly to prevent Time Machine from backing up the entirety of very large files).

However, I'm planning to restructure my storage in the near future, and will likely be eliminating the use of these disk images.

What I'd like to be able to do is mount a sparse bundle that's located on my Time Machine backup drive, so that I can copy data from inside it into its new location, without having to copy the disk image first (requiring double the storage).

The problem is, none of my backed up sparse bundle images can be mounted from a Time Machine volume, all I get is a "no mountable filesystems" error. Assuming the issue is that Time Machine volumes are effectively read-only, I tried the following command instead:

hdiutil attach /Volumes/Backup/Backups.backupdb/MachineName/Latest/Path/To/Image.sparsebundle -readonly

However this doesn't work either, producing the same error.

Now, I'm fairly certain this is an issue specific to mounting sparse bundles from a Time Machine backup, as I'm sure the images themselves are fully intact (I've shasumed all the contents and compared to the source).

Is there a way that I can mount a sparse bundle from a Time Machine backup, without having to copy it in its entirety to somewhere else first?

To be clear, and to disambiguate from similar questions; the disk images I'm referring to are inside my Time Machine backup, they are not the Time Machine backup itself, i.e- I'm backing up to a directly attached drive, not a network disk.

UPDATE: So I had an idea of my own, which was to create a hard-linked copy of the image outside of the Backups.backupdb folder, thinking perhaps that that may be mountable without issues, but this doesn't appear to be possible either. Running gcp -lr to do this results in stat giving a "permission denied" error, so presumably Time Machine backups also resist stating of files for some reason.


If you are ok with creating a temporary shadow file, you can mount it this way:

hdiutil attach -shadow /path/to/store/the/temporary/file.shadow /Volumes/Backup/Backups.backupdb/MachineName/Latest/Path/To/Image.sparsebundle

For succinctness, that is: hdiutil attach -shadow <shadowfile> <imagefile>

Edit: in a previous version of my answer I included the -readonly flag in the command, but I've found that it will sometimes fail with "no mountable file systems" when -readonly is passed. Omitting the flag in these cases allowed the image to be mounted successfully.

As such, I've updated the answer to exclude the -readonly flag. Just note that any changes you make in rw mode will only be written to the shadow file.