Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Reduce size of compressed disk images System
I'm distributing software for Mac OS X using .dmg images created with Disk Copy. I have a (uncompressed) read/write image where all the image options are set accordingly (background, window position, icon size, etc.). Whenever I release a new version of my software, I would replace the application on the read/write image with the new version and compress the image using Disk Copy.

When creating a new image today, I noticed that although the software didn't grow in size, the compressed image did (3.1 MB vs. 2.9 MB). I thought it might be some kind of fragmenting issue and indeed: after I had deleted all files on the read/write image, emptied the trash, copied the files to the image and compressed it again, the new image was just 2.6 MB!

Bottom line: Never replace files on a disk image which is to be compressed - delete and copy them.
  • Currently 2.40 / 5
  You rated: 2 / 5 (5 votes cast)

Reduce size of compressed disk images | 4 comments | Create New Account
Click here to return to the 'Reduce size of compressed disk images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Reduce size of compressed disk images
Authored by: bluehz on Jun 09, '03 11:01:57AM

Did you actually compress the .dmg after noticing the larger size, or was that larger size actually after you had compressed it. Reason I ask is - OS X disk images are quite fascinating objects in that they expand and contract to suit the needs of the contents. This format fo disk image is known as "sparse" in teh documentation, and I believe that its the default when creating disk images with Disk Copy. I may be wrong - but what you might have been seeing - if you had not yet recompressed the .dmg - is possibly a temp size boost. This size difference may have disappeared when you recompressed the .dmg again. Just a theory...

[ Reply to This | # ]
Reduce size of compressed disk images
Authored by: triplef on Jun 09, '03 11:16:26AM

I wasn't using a sparse image - AFAIK the only way to create sparse images is to use the command line tool. The larger size was after I had compressed the image with Disk Copy.

[ Reply to This | # ]
Reduce size of compressed disk images
Authored by: rselph on Jun 09, '03 01:11:51PM

Sparse images aren't that good a solution to this problem anyway.

The problem is that the sparse image disk "driver" doesn't have any knowledge about HFS+, or whatever other filesystem is on the disk. This means that space for deleted files is never reclaimed. Once a disk sector has been touch by the file system for any use at all, it will remain part of the sparse image, even if HFS+ considers the file to be deleted.

Sparse images are really useful for building a compressed image when you're not sure of the total size you will need. But basically it's designed to be used once and thrown away.

[ Reply to This | # ]
An alternative
Authored by: jcteo on Jun 09, '03 08:11:32PM

My experience has been EXACTLY like you described!

I went through this tedious process each time I made a new release. Not only was it tedious but the image kept growing "mysteriously".

Then one day I found FileStorm (from MindVision) and gave it a shot. I purchased it after playing with it for 10 minutes. It is worth every single penny considering how much time it is saving me.


ps. I have no relation to the good folks at MindVision.

[ Reply to This | # ]