Completely recover space from sparse bundle when “hdiutil compact” is not enough

sparsebundle

Current situation: I have a large sparse bundle image whose size is reported as 91GB (cmd+I from Finder). Its contents, instead, are only 80GB. hdiutil compact does not shrink the image:

Starting to compact…
Reclaiming free space…
..............................................................................
Finishing compaction…
Reclaimed 0 bytes out of 25.6 GB possible.

So there are 11GB of space that I cannot recover.

How I got there: Before getting into this situation, I had ~27GB of smallish files (MP3s, from 2-8MB) that I deleted from the image. I then ran hdiutil compact, but it only recovered 16GB of those 27GB, leaving 11GB of wasted space.

Any idea? Google is failing me.

Best Answer

Either recreate the image, or defragment and repeat hdiutil compact. For defragmentation, I use iDefrag.