Sparse Disk Image and sizing

I am finding conflicting information about sparse disk images. I use an encrypted sparse disk image as a secure file repository for sensitive information, this is created by Disk Utility. When I first set this up I read that the "Size" field in Disk Utility has little meaning for a Sparse Disk Image as the image grows as required. I set it quite small. I now read that this field specifies the MAXIMUM size that the disk image can grow to.

Which is the case, does anyone know?

If it IS the maximum size, can I change it?

Also, can a "sparse" disk image shrink?

Regards - Lawrence

2 x MacMini, Mac Book Pro 17", 24" iMac and a panic of PCs, Mac OS X (10.5.5)

Posted on Oct 13, 2009 8:16 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 13, 2009 9:05 AM

the size of a sparse image you set at creation time is the maximum size. it has little meaning in the sense that you can set it to be huge and it won't affect how much space the disk image actually takes on the hard drive. if you make a sparse image with max size 100GB but only put 1GB of data on it then it will only take 1GB of data on the drive. this is different from a regular disk image which will take as much space on the drive as the maximum size you set.

you can change the max size of the sparse image from terminal. first unmount it. then run the following terminal command


hdiutil resize -size 50g /path/to/sparse/image


instead of 50g put the max size of the sparse image you want. 50g means 50GB.
put the path to the sparse disk image in the command. you can decrease the max size using the command too but there is never any need to do so.

one more thing. if you delete some stuff from a sparse image it does not automatically decrease the space it takes on the hard drive. to force it to reclaim that space run the command

hdiutil compact /path/to/sparseimage
1 reply
Question marked as Top-ranking reply

Oct 13, 2009 9:05 AM in response to LawrenceHare

the size of a sparse image you set at creation time is the maximum size. it has little meaning in the sense that you can set it to be huge and it won't affect how much space the disk image actually takes on the hard drive. if you make a sparse image with max size 100GB but only put 1GB of data on it then it will only take 1GB of data on the drive. this is different from a regular disk image which will take as much space on the drive as the maximum size you set.

you can change the max size of the sparse image from terminal. first unmount it. then run the following terminal command


hdiutil resize -size 50g /path/to/sparse/image


instead of 50g put the max size of the sparse image you want. 50g means 50GB.
put the path to the sparse disk image in the command. you can decrease the max size using the command too but there is never any need to do so.

one more thing. if you delete some stuff from a sparse image it does not automatically decrease the space it takes on the hard drive. to force it to reclaim that space run the command

hdiutil compact /path/to/sparseimage

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Sparse Disk Image and sizing

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.