Among the many complex command tools,
hdiutil, for working with disk images, has to be one of the most difficult. Some of its most interesting controls are buried deep in its elaborate system of verbs and options, and its long and opaque man page. Spundle is a new app which provides a convenient wrapper for three of its functions on sparse bundles: their creation, resizing and compaction.
It’s a single window utility which runs on all versions of macOS from Sierra to Catalina.
To create a new, empty sparse bundle simply set its maximum size using the numeric entry and unit popup at the left of the upper row of controls. Then, at the right, select the file system you want your sparse bundle to use. The choice includes two variants of HFS+ (with or without journaling), APFS, two PC file systems (FAT32 and exFAT), and UDF.
If you’re content leaving the bundle with the default maximum band size, leave that set at 0 and click on the Create button. Spundle will then ask you to locate and name your new sparse bundle, and create it for you.
Default band size is likely to be close to optimal in many cases, but where you’re creating sparse bundles to host Time Machine or other backups, or very small or large bundles, you may wish to use smaller or larger bands. Spundle lets you set those across the whole range up to gigabytes if you wish. These are a bit more complex than the maximum size of the bundle:
hdiutil actually works with band sizes in terms of 512 byte sectors. To keep this as simple as possible, Spundle converts the figure you enter here to multiples of 1024 bytes. Set 1 MB, and the actual band size used will be 1,024,000 bytes, or 1.024 MB, and so on.
Freshly created empty sparse bundles of 1 GB maximum size typically require around 20 MB of storage space, although the two HFS+ variants are more demanding, at 50 MB without and 59 MB with journaling. They each default to using 8.4 MB bands, most requiring just 4 when the bundle is empty. Again, HFS+ requires more, at 9 bands without journaling, and 10 with it.
Changing the maximum size of an existing sparse bundle is just a matter of setting the new size, clicking the Change size button, and selecting the bundle to be modified. Spundle’s Help book explains how to work round the bug in Mojave and earlier which failed to adjust container size when changing the size of APFS sparse bundles, and thankfully that isn’t necessary now in Catalina.
Compacting an existing HFS+ or APFS sparse bundle is a three-click operation: first on the Compact button, then selecting the bundle to compact and clicking the last button in the Open File dialog initiates compaction.
For those who don’t want to familiarise themselves with all the intricacies and quirks of
hdiutil, or just for speed and simplicity, Spundle is a straightforward but powerful way to work with sparse bundles. It should be particularly useful for anyone wanting to test software on multiple file systems, ideal for those who want to confirm which extended attributes are preserved, for example. I’ll also be trying it as a way of setting up a sparse bundle suitable for backups, where control over band size is particularly important.
Spundle version 1.0 is now available from here: spundle1
from Downloads above, and from its Product Page here. As it uses my auto-update mechanism, future updates will be available within the app itself.