- Apple Disk Image
-
Apple Disk Image Filename extension .dmg
,.smi
,.img
Internet media type application/x-apple-diskimage
Uniform Type Identifier com.apple.disk-image
,com.apple.disk-image-smi
Developed by Apple Inc. Apple Disk Image is a proprietary disk image format commonly used with the Mac OS X operating system. The format allows secure password protection as well as file compression and hence serves both security and file distribution functions; it is most commonly used to distribute software over the Internet. Universal Disk Image (UDIF) is a flat file format, and is the native image format for Mac OS X.
Newly created Apple Disk Images typically have a .dmg extension, although legacy Apple Disk Image files intended for Mac OS 9 and earlier generally have .smi or .img file extensions.[1] Apple Disk Image files are published with a MIME type of application/x-apple-diskimage. When opened, an Apple Disk Image is "mounted" as a drive within the Finder.
Apple Disk Images can be created using utilities bundled with Mac OS X, specifically Disk Copy in Mac OS X v10.2 and earlier and Disk Utility in Mac OS X v10.3 and later. These utilities can also use Apple Disk Image files as images for burning CDs and DVDs. Disk Image files may also be managed via the command line using the hdiutil utility. The format can also be opened by MagicISO and the freeware MagicDisc on Microsoft Windows, along with several free software implementations.
Contents
Data format
Files with the extension .dmg are essentially raw disk images (i.e. contain block data), optionally with one or two layers applied that provide compression and encryption. In hdiutil these layers are called CUDIFEncoding and CEncryptedEncoding.[2]
UDIF supports ADC (an old proprietary compression format by Apple), zlib and bzip2 compression internally.
Header
The header can be described using the following C structure. All values are little-endian (Apple II byte ordering)
Position(in Hex) Length (in bytes) Description 000 4 The integer constant '2IMG'. This integer should be little-endian, so on the Apple IIgs, this is equivalent to the four characters 'GMI2'; in ORCA/C 2.1, you can use the integer constant '2IMG'. 004 4 A four-character tag identifying the application that created the file. 008 2 The length of this header, in bytes. Should be 52. 00A 2 The version number of the image file format. Should be 1. 00C 4 The image format. 010 4 Flags 014 4 The number of 512-byte blocks in the disk image. This value should be zero unless the image format is 1 (ProDOS order). 018 4 Offset to the first byte of the first block of the disk in the image file, from the beginning of the file. The disk data must come before the comment and creator-specific chunks. 01C 4 Length of the disk data in bytes. This should be the number of blocks * 512. 020 4 Offset to the first byte of the image comment. Can be zero if there's no comment. The comment must come after the data chunk, but before the creator-specific chunk. The comment, if it exists, should be raw text; no length byte or C-style null terminator byte is required (that's what the next field is for). 024 4 Length of the comment chunk. Zero if there's no comment. 028 4 Offset to the first byte of the creator-specific data chunk, or zero if there is none. 02C 4 Length of the creator-specific chunk; zero if there is no creator-specific data. 030 16 Reserved space; this pads the header to 64 bytes. These values must all be zero. Image format field
The image format is indicated as one of the following values:
Format Value DOS 3.3 Order 0 ProDOS Order 1 Nibblized data 2 Flags
The flags field contains bit flags that specify details about the disk image. Bits not defined here must be zero.
Bit Description 31 If this bit is set, the disk image is locked and no changes should be permitted to the disk data it contains. This is used by emulators to provide support for write-protecting disk images. 8 If this bit is set, the low byte of the flags field contains the DOS 3.3 volume number of the disk image. This bit should only be set for DOS 3.3 disk images. If the disk is DOS 3.3 format (the image format is 0), and this bit is 0, volume number 254 is assumed. 7-0 The DOS 3.3 volume number, from 0-254, if bit 8 is set. Otherwise these bits should be 0. Support
Macintosh
In Mac OS X v10.2.3, Apple introduced Internet-Enabled Disk Images for use with the Apple utility Disk Copy, which was integrated into Disk Utility in 10.3. The Disk Copy application had the ability to display a multi-lingual software license agreement before mounting a disk image. The image will not be mounted unless the user indicates agreement with the license.[3]
Currently, the only way to open a Disk Image in Mac OS 9 is to use either the developer version of Disk Copy (version 6.4), or a beta version of the unreleased 6.5. However, both versions can only open uncompressed images; compressed Disk Images are unusable on Mac OS 9.[original research?]
Non-Macintosh
Apple has not released any documentation on the format, but attempts to reverse engineer parts of the format have been successful. Free software implementations include dmg2img[4] and DMGExtractor.[5]
The encrypted layer was reverse engineered in an implementation called VileFault[6] (A spoonerism of FileVault), and dmg2img and DMGExtractor have since implemented support for encrypted images. DMG files can be converted into ISO files using software like PowerISO.[7][8]
There are few options available to extract files or mount the proprietary Apple Disk Image format. The supported features are limited because of the proprietary nature of the format.
The well-known cross-platform and GPL licensed format conversion utilities are:[original research?]
- dmg2img
- DMGEXtractor
- PeaZip
dmg2img[4] was originally written in Perl; however, the Perl version is no longer maintained, and the project was rewritten in C. Currently, without additional tools, the resulting images may be mounted only under Mac OS X and under Linux (provided hfsplus support has been enabled). UDIF ADC-compressed images have been supported since version 1.5.
DMGExtractor[5] is written in Java with GUI, and it supports more advanced features of dmg including AES-128 encrypted images but not UDCO images.
In Windows, most dmg images can be opened using several other programs such as Acute Systems TransMac, HFSExplorer, 7-Zip, UltraISO, and IsoBuster. MacDrive[9] can also mount simple dmg files as drives under windows, but not sparse disk or encrypted dmgs.
In Linux and possibly other Unix flavors, most .dmg files can be burned to CD/DVD using the program cdrecord or directly mounted to a mountpoint (e.g. mount -o loop,ro -t hfsplus imagefile.dmg /mnt/mountpoint).
PowerISO is a proprietary, cross platform, Freeware CLI tool that runs on Linux; it can convert most proprietary image formats to ISO, and newer versions support .dmg.
See also
References
- ^ "Software Downloads: Formats and Common Error Messages". http://docs.info.apple.com/article.html?artnum=75098. Retrieved 2009-05-06.
- ^ "hdiutil man page". http://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/man1/hdiutil.1.html. Retrieved 2008-11-30.
- ^ "Guides". Apple. http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution4/Concepts/sd_disk_images.html. Retrieved 2010-10-27.
- ^ a b "dmg2img". http://vu1tur.eu.org/tools/. Retrieved 2010-10-27.
- ^ a b "DMGExtractor". http://www.catacombae.org/dmgx.html. Retrieved 2011-01-03.
- ^ "VileFault". 2006-12-29. http://crypto.nsa.org/vilefault/. Retrieved 2010-10-27.
- ^ "How To Convert DMG To ISO in Windows, Linux & Mac". http://www.davidtan.org/how-to-convert-dmg-to-iso-on-mac-osx-windows-and-linux/.
- ^ "Convert DMG To ISO using PowerISO". http://hydtech.wordpress.com/2009/01/29/how-to-convert-dmg-files-to-iso-using-poweriso/. Retrieved 2009-02-15.
- ^ MacDrive Features / Boot Camp / System Requirements /. "MacDrive Home page". Mediafour. http://www.mediafour.com/products/macdrive/. Retrieved 2010-10-27.
External links
- Apple Developer Connection A Quick Look at PackageMaker and Installer
- O'Reilly Mac DevCenter Tip 16-5. Create a Disk Image from a Directory in the Terminal
- man page for hdiutil
Archive formats Archiving only Compression only Archiving and compression Software packaging and distribution - pkg (SVR4)
- deb
- pkg (Mac OS X)
- RPM
- RUNZ
- MSI
- JAR
- WAR
- RAR (Java)
- EAR
Document packaging and distribution Disk image file formats Optical disc Hard disk Floppy disk Categories:- Computer file formats
- Archive formats
- Mac OS X
- Disk images
- Compression file systems
Wikimedia Foundation. 2010.