Suffix

Published by Simon Schoeters

Create a small disk image

I needed a small disk image (a .dmg file) for the Lightroom export plugin I wrote earlier but for some reason the built-in ‘Disk Utility’ program in Mac OS X Leopard does not allow you to create a disk image smaller than 10 MB. Sure, you can select a custom size but the tool changes it back to a minimum of 10 MB with the following message:

The image size was changed to 10 MB because that is the minimum image size.

I have no idea why it says that because you can make smaller disk images, just not via the Disk Utility program. Fire up ‘Terminal’ and see for yourself. The following command creates a disk image in HFS+ format with a size of only 600 KB:

hdiutil create -size 600k myImage.dmg -srcfolder myFolder/ -fs HFS+

The size can be specified with -size < ?? | ??b | ??k | ??m | ??g | ??t | ??p | ??e > but the minimum disk image size with this method is still 512 KB. I don't understand this minimum size as the created disk image is only as large as the data it contains. When I use this method to create a disk image with an empty folder the resulting image is only 10 KB, not 600 KB as specified in with the ‘-size’ option.

Other hdiutil uses