Further compression of disk image files

9,420

Solution 1

The Disk Image - is it currently compressed already and if so, did you use the default offered by Disk Utility? You can find out in Disk Utility or by running hdiutil imageinfo /PATH/To/DMG | grep 'Format'. The different formats you may see (more at man hdiutil):

UDRW - UDIF read/write image
UDRO - UDIF read-only image
UDCO - UDIF ADC-compressed image
UDZO - UDIF zlib-compressed image
UDBZ - UDIF bzip2-compressed image (OS X 10.4+ only)
UFBI - UDIF entire image with MD5 checksum
UDTO - DVD/CD-R master for export
UDSP - SPARSE (grows with content)
UDSB - SPARSEBUNDLE (grows with content; bundle-backed)

By default Mac OS X will use UDRW for a standard read/write image, UDRO for a read only image and UDZO for an image made using Disk Utility that was chosen as compressed.

In terms of compatibility and file size of the compressed option ADC gives you the worst compression but is compatible all the way back to 10.0, zlib compression back to 10.1 whereas bzip2 is much smaller it takes longer to create and longer to uncompress and requires Mac OS X 10.4 or newer. Well, except the default compression algorithm in 10.6 seems to work better than UDBZ. The Lion installer disk image compresses down more with the default compression algorithm than it does if converted to UDBZ!

I would suggest changing the compression to bzip2 and see how much space that saves you. That said if it's a disk image of images and videos it won't save you much space as the files in question are already compressed. To change the compression to bzip2 and create a new bzip2 compressed disk image you can run the following command:

hdiutil convert /PATH/TO/IMAGE.dmg -format UDBZ -o /PATH/TO/NEW/IMAGE.dmg

If you want a GUI for making bzip2 disk images or more I suggest taking a look at other .dmg creation products such as DropDMG

Solution 2

Probably wouldn't gain much by compressing twice. Make a new image with less data in it, or use a file splitter to put it on two disks instead of one, and reassemble later.

Solution 3

When you perform a Get Info on the original folder or disk, how big is it? What's the current compression ratio?

Chances are you could ZIP or RAR it, and get 3% - 5% compression... But is it really worth it? You'll spend an additional half hour, to hour attempting to compress already compressed data.

1) Try to create a sparse bundle that contains your information, and see if that is any smaller... 2) Does it have to be a disk image? If you have a target size, would ZIPing or RARing that data work better?

Share:
9,420

Related videos on Youtube

Kato
Author by

Kato

Updated on September 17, 2022

Comments

  • Kato
    Kato almost 2 years

    Is there a way to further compress a disk image file created by the disk utility program on macs? I need to fit a 6.5G/5.5G image onto a 4.7G disk.

    • Admin
      Admin over 14 years
      You might consider getting dual-layer DVD-R[W?] media, too: if the disk image is already in a compressed form, you're not likely to get the requested ~30% reduction
  • mmmmmm
    mmmmmm over 14 years
    Also try zip or rar forst might get more compression but I doubt by the amount you want
  • elder elder
    elder elder almost 8 years
    Upvoted, this is exactly what I was looking for!