Thursday, November 30, 2023

Disk Images in Sonoma

Howard Oakley:

Band size is the maximum size of each band file, and determines two things: the number of band files, and how efficiently the whole sparse bundle can change in size. In most cases, the default is 8.4 MB, which generally works well for all but the largest of sparse bundles. There’s one important limit to bear in mind when setting band size: all the bands of a sparse bundle are stored inside a single folder. If the number of bands reaches the maximum for a single folder for the host file system, then it will start to fail, and you could lose part or all of its contents. Currently, in macOS with HFS+ or APFS, that critical number is believed to be 100,000 (an empirical guesstimate). So whatever you do, ensure that your sparse bundle will never need 100,000 or more band files, as that could spell disaster.


Note, though, that setting too small a band size may limit the maximum size for the whole sparse bundle. When creating very large sparse bundles, macOS may restrict their size if the chosen band size is too small.


This stopped working by macOS Ventura 13.3.1, since when hdiutil still goes through the same sequence but the password remains unchanged. As of Sonoma 14.1.1 this remains broken, as Apple has still not fixed this bug.


1 Comment RSS · Twitter · Mastodon

I've had a different issue since Ventura 13.3.1... my HFS+ sparse bundles aren't... sparse anymore.

I've got an image that reports a capacity of 4.23GB, with only 1.18GB used on disk. If I convert it to UDRW, it reports it's a size of 2.15GB on disk. If I convert it to (uncompressed) qcow2, it reports it's 623MB. All free space has been zeroed.

If I convert to UDSB with a 1MB band size, the total size on disk is... 2.15GB.

I think I know the cause though. I've got HFSFuse installed (so I can read/write 1990s HFS images), and I think this is confusing the new hfsutil, which refers to HFS+ volumes as "HFS". I think what's happening is that hfsutil is looking at the volume while converting / compacting and deciding that it doesn't know what this partition format is, so it's just writing the entire thing, free space and all.

I have no clue how to fix this, unfortunately, other than to unload the HFS fsbundle prior to compacting/converting... maybe?

Leave a Comment