Small disk images
Create even smaller Mac OS X disk images via the command line.
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 doesn’t allow me 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:
The size can be specified with -size < ?? | ??b | ??k | ??m | ??g | ??t | ??p | ??e > but the smallest 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 holds. 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
- Use hdiutil to convert .dmg files to .iso files to burn them elsewhere.
- Using hdiutil for creating, (un)mounting, burning and encrypting disk images.