Dynamic dmg files

I have a folder that I want to password protect by converting it to a writable .dmg file. So far so good. I know how to do this. What I would like to know if it is possible to create a dmg file that will expand as I continue to add data to it.

G4/Mirror, Mac OS X (10.4.8), 2 GB RAM

Posted on Oct 17, 2006 3:11 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 17, 2006 9:16 AM

Ummm... actually yes you can... at least you can create the sparse image...

In Disk Utility select "File -> New -> Blank Disk Image..."

In the "New Blank Image" window give your image file a name and select a location. Then for "Size" set the maximum size you'd like the image to be able to grow to. For "Encryption" select "AES-128" and for "Format" select "sparse disk image".

As an example I created a 500mb sparse image. The initial image file was only 18mb... after copying a few files it had grown to 39mb... presumably it will allow me to add files until it reaches the 500mb maximum. You could give the image a much larger max size to begin with... as long as the image file doesn't end up growing larger than the physical disk space you need to store it.

If you later find you need to expand an existing sparse image to accomodate a larger max size or compact it to reclaim space freed by deleting files then you'll probably have to resort to the command line... I don't believe Disk Utility provide options for performing those actions.

Steve
4 replies
Question marked as Top-ranking reply

Oct 17, 2006 9:16 AM in response to Randy McElligott1

Ummm... actually yes you can... at least you can create the sparse image...

In Disk Utility select "File -> New -> Blank Disk Image..."

In the "New Blank Image" window give your image file a name and select a location. Then for "Size" set the maximum size you'd like the image to be able to grow to. For "Encryption" select "AES-128" and for "Format" select "sparse disk image".

As an example I created a 500mb sparse image. The initial image file was only 18mb... after copying a few files it had grown to 39mb... presumably it will allow me to add files until it reaches the 500mb maximum. You could give the image a much larger max size to begin with... as long as the image file doesn't end up growing larger than the physical disk space you need to store it.

If you later find you need to expand an existing sparse image to accomodate a larger max size or compact it to reclaim space freed by deleting files then you'll probably have to resort to the command line... I don't believe Disk Utility provide options for performing those actions.

Steve

Oct 17, 2006 5:20 AM in response to Randy McElligott1

As far as I know, .dmg files are fixed in size when you create them in Disk Utility; you need to allow extra space for expected growth, using if necessary the custom size option in Disk Utility. There are third party utilities that implement PGP encryption that should allow the protected source to grow on the fly; e.g., the freeware Gpg Tools and the commercial PGP Desktop.

Oct 17, 2006 5:51 AM in response to Randy McElligott1

You can create a sparse image using hdiutil from the command line. I believe you still have to specify a maximum size when you create it, but once created the dmg file itself will only take up slightly more space than the files it contains... and will grow (up to it's max size) as new files are added.

If you eventually reach the max size specified during image creation there are additional hdiutil options for stretching or resizing the sparse image. There are also options for compacting a sparse image to reclaim space if you have a need to do that.

This is basically the way a FileVaulted home folder works. See "man hdiutil" in Terminal for all the gory details.

There may be some third party utilities that have wrapped these commands into a GUI app, but I'm not sure so can't recommend any.

Steve

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.

Dynamic dmg files

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