Apple - Change DMG capacity

There isn't a good way via GUI that I've seen to do this - you've got to use hdiutil as you asked. It's a quick command. To resize (change 25G to whatever you want),

hdiutil resize -size 25G /PATH/TO/DISK/IMAGE.dmg

Another way to compress it is to clone your disk image into a sparsebundle, then compress the sparsebundle. This may or may not work, depending on how much compression takes place.

First, create the disk image which mirrors your old disk image:

hdiutil convert /location/of/disk.dmg -format UDSP -o /PATH/TO/NEWIMAGE.sparseimage

Then, compact the resulting sparseimage:

hdiutil compact /PATH/TO/NEWIMAGE.sparseimage

If these commands don't work then it's got something to do with your disk image and/or permissions.

I have spent a lot of time playing with hdiutil and it's far from flawless - I've found & submitted bugs in Snow Leopard that still haven't been corrected in Mountain Lion, so if you do get a bit of odd behavior, don't be off-put!

Tags:

Macos