I want to resize (shrink) the capacity of the backup.sparsebundle to approx. the size actually taken up the files.
What I did thus far
I already compacted the image:
# hdiutil compact backup.sparsebundle
Starting to compact…
Reclaiming free space…
.............................................................................
Finishing compaction…
Reclaimed 0 bytes out of 265.2 GB possible.
The stats
My system:
# system_profiler SPSoftwareDataType
System Version: OS X 10.11.5 (15F34)
Kernel Version: Darwin 15.5.0
Boot Mode: Normal
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Disk image size:
# du -sh backup.sparsebundle
213G backup.sparsebundle
Volume size:
# diskutil info /Volumes/backup | grep -E 'Free Space|Total Size'
Total Size: 501.8 GB (501806010368 Bytes) (exactly 980089864 512-Byte-Units)
Volume Free Space: 284.8 GB (284753629184 Bytes) (exactly 556159432 512-Byte-Units)
The problem
The problem is that hdiutil doesn't allow to shrink the image, because the target size is below the content-min-length allowed:
# hdiutil resize -size 224GB MBA11-backup.sparsebundle
hdiutil: resize request 469762048 is below minimum size 800587800 allowed.
hdiutil: resize: failed. Invalid argument (22)
Here are the limits:
# hdiutil resize -limits MBA11-backup.sparsebundle
min cur max
800587800 980089864 34359738368
The values are in 512 sized sectors, so the minimal size is (800587800 * 512) = 409900953600 bytes or 409.90 GB.
What I want to achieve
I would like to get rid of the free space and shrink the image Total Size of 501.8 GB to approx. the space actually in use of 217 GB (Total Size minus Free Space).
- Why is the minimal size allowed so much greater than the actual space in use?
- How can I reduce the minimal size set in order to shrink the image to the approx. actual space in use?