Apple Disk Image

Apple Disk Image
Apple Disk Image
Mac OS X Disk Image.png
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[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

External links



Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Disk image — CD image redirects here. For ISO 9660 image files, see ISO image. A disk image is a single file or storage device containing the complete contents and structure representing a data storage medium or device, such as a hard drive, tape drive,… …   Wikipedia

  • Disk Image (Apple) — Disk Image Dateien (Endung .dmg oder .sparseimage oder .sparsebundle) sind ein Speicherabbild Datenformat unter Mac OS X. Sie haben den MIME Typ application/octet stream. Es kann sowohl durch Passwort geschützt als auch komprimiert werden und… …   Deutsch Wikipedia

  • Universal Disk Image Format — UDIF stands for Universal Disk Image Format. It is used on Mac OS X for .dmg disk images. UDIF is a flat file format, and is the native image format for Mac OS X.The format can also be opened by MagicISO and the freeware MagicDisc on… …   Wikipedia

  • Disk Utility — Developer(s) Apple Inc …   Wikipedia

  • Disk Copy — Developer(s) Apple Computer Stable release 10.2 Operating system System Software 6, System 7, Mac OS 8, Mac OS 9, Mac OS X v10.0, Mac OS X v10.1, Mac OS X v10.2 …   Wikipedia

  • Disk editor — A disk editor is a computer program that allows its user to read, edit, and write raw data (at character or hexadecimal, byte levels) on disk drives (e.g., hard disks, USB flash disks or removable media such as a floppy disks); as such, they are… …   Wikipedia

  • Apple II series — The Apple II (often written as Apple ] [ or Apple //) was the first mass produced microcomputer product, manufactured by Apple Computer (now Apple Inc.). It was among the first home computers on the market, and became one of the most recognizable …   Wikipedia

  • Apple Software Restore — Infobox Software name = Apple Software Restore caption = author = developer = Apple Computer released = latest release version = 64.6 latest release date = latest preview version = latest preview date = operating system = Mac OS X platform =… …   Wikipedia

  • Disk Utility — Тип Дисковые утилиты Разработчик Apple Inc. Операционная система Mac OS X Последняя версия 11.5 (298) (28 августа, 2009) Лицензия Проприетарное программное обеспечение D …   Википедия

  • ISO image — Infobox file format name = ISO image icon = caption = extension = .iso mime = type code = uniform type = public.iso image magic = owner = genre = Disk image container for = contained by = extended from = extended to = standard = ISO 9660An ISO… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”