请输入您要查询的百科知识:

 

词条 Apple Disk Image
释义

  1. Overview

  2. UDIF data format

      Trailer  

  3. Support

      Macintosh  

  4. See also

  5. References

  6. External links

{{Infobox file format
| name = Apple Disk Image
| logo =
| icon =
| iconcaption = The icon represents an internal hard drive within a generic file icon.
| screenshot =
| caption =
| extension = .dmg, .smi, .img
| mime = application/x-apple-diskimage
| type code =
| uniform type = com.apple.disk-image,
com.apple.disk-image-smi

| conforms to =
| magic =
| owner = Apple Inc.
| released =
| latest release version =
| latest release date =
| genre = disk image
| container for =
| contained by =
| extended from =
| extended to =
| standard =
| free =
| url = apple.com
}}

An Apple Disk Image is a disk image commonly used by the macOS operating system. When opened, an Apple disk image is "mounted" as a volume within the Finder. An Apple disk image can be structured according to one of several proprietary disk image formats, including the Universal Disk Image Format (UDIF) and the New Disk Image Format (NDIF). An Apple disk image file's name usually has ".dmg" as its extension.

An Apple disk image allows secure password protection as well as file compression, and hence serves both security and file distribution functions; such a disk image is most commonly used to distribute software over the Internet.

Overview

Apple originally created its disk image formats because the resource fork used by Mac applications could not easily be transferred over mixed networks such as those that make up the Internet. Even as the use of resource forks declined with Mac OS X, disk images remained the standard software distribution format. Disk images allow the distributor to control the Finder's presentation of the window, which is commonly used to instruct the user to copy the application to the correct folder.

Universal Disk Image Format (UDIF) is the native disk image format for Mac OS X. Disk images in this format typically have a .dmg extension.[1] New Disk Image Format (NDIF) was the previous default disk image format in Mac OS 9,[1] and disk images with this format generally have a .img (not to be confused with raw .img disk image files) or .smi file extension. Files with the .smi extension are actually applications that mount an embedded disk image, thus a "Self Mounting Image", and are intended only for Mac OS 9 and earlier.[2][3] A previous version of the format, intended only for floppy disk images, is usually referred to as "Disk Copy 4.2" format, after the version of the Disk Copy utility that was used to handle these images.[1] A similar format that supported compression of floppy disk images is called DART.[1][4] Apple disk image files are published with a MIME type of application/x-apple-diskimage.

Different file systems can be contained inside these disk images, and there is also support for creating hybrid optical media images that contain multiple file systems.[1] Some of the file systems supported include Hierarchical File System (HFS), HFS Plus, File Allocation Table (FAT), ISO9660 and Universal Disk Format (UDF).[1][3]

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 [https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/hdiutil.1.html hdiutil utility].

UDIF data format

Apple disk image files are essentially raw disk images (i.e. contain block data) with some added metadata, optionally with one or two layers applied that provide compression and encryption. In hdiutil these layers are called CUDIFEncoding and CEncryptedEncoding.[1]

UDIF supports ADC (an old proprietary compression format by Apple), zlib, bzip2 (as of Mac OS X v10.4), and LZFSE (as of Mac OS X v10.11)[5] compression internally.

Trailer

The trailer can be described using the following C structure.[6] All values are big-endian (PowerPC byte ordering)

 typedef struct {        uint8_t     Signature[4];        uint32_t Version;        uint32_t HeaderSize;        uint32_t Flags;                         uint64_t RunningDataForkOffset;        uint64_t DataForkOffset;        uint64_t DataForkLength;        uint64_t RsrcForkOffset;             uint64_t RsrcForkLength;                uint32_t SegmentNumber;        uint32_t SegmentCount;        uuid_t   SegmentID;        uint32_t DataChecksumType;        uint32_t DataChecksumSize;        uint32_t DataChecksum[32];        uint64_t XMLOffset;         uint64_t XMLLength;         uint8_t  Reserved1[120];        uint32_t ChecksumType;        uint32_t ChecksumSize;        uint32_t Checksum[32];        uint32_t ImageVariant;        uint64_t SectorCount;        uint32_t reserved2;        uint32_t reserved3;        uint32_t reserved4; } __attribute__((__packed__)) UDIFResourceFile;

Here is an explanation:

Position(in Hex) Length (in bytes) Description
000 4 Magic bytes ('koly').
004 4 File version (current is 4)
008 4 The length of this header, in bytes. Should be 512.
00C 4 Flags.
010 8 Unknown.
018 8 Data fork offset (usually 0, beginning of file)
020 8 Size of data fork (usually up to the XMLOffset, below)
028 8 Resource fork offset, if any
030 8 Resource fork length, if any
038 4 Segment number. Usually 1, may be 0
03C 4 Segment count. Usually 1, may be 0
040 16 128-bit GUID identifier of segment
050 4 Data fork checksum type
054 4 Data fork checksum size
058 128 Data fork checksum
0D8 8 Offset of XML property list in DMG, from beginning
0E0 8 Length of XML property list
0E8 120 Reserved bytes
160 4 Master checksum type
164 4 Master checksum size
168 128 Master checksum
1E8 4 Unknown, commonly 1
1EC 8 Size of DMG when expanded, in sectors
1F4 12 Reserved bytes (zeroes)

Support

Apple has not released any documentation on the format, but attempts to reverse engineer parts of the format have been successful. The encrypted layer was reverse engineered in an implementation called VileFault[7] (a spoonerism of FileVault). There are few options available to extract files or mount the proprietary Apple Disk Image format. Some cross-platform conversion utilities are:

  • dmg2img 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.[8]
  • DMGEXtractor is written in Java with GUI, and it supports more advanced features of dmg including AES-128 encrypted images but not UDCO images.[9]
  • 7-Zip, including the free cross-platform port of its command-line interface, p7zip.
  • PeaZip

In Windows, most dmg images can be opened using several other programs such as UltraISO and IsoBuster. MacDrive can also mount simple dmg files as drives under windows, but not sparse disk or encrypted dmgs.[10] A free Apple DMG Disk Image Viewer also exists.[11]

In Linux and possibly other Unix flavors, most .dmg files can be burned to CD/DVD using any CD-burner program (using cdrecord directly or a front-end such as K3B or Brasero) or directly mounted to a mountpoint (e.g. {{code|2=bash|mount -o loop,ro -t hfsplus imagefile.dmg /mnt/mountpoint}}).[12][13] darling-dmg is a FUSE module enabling easy DMG file mounting on Linux.[14]

Macintosh

In Mac OS X v10.2.3, Apple introduced Compressed Disk Images[15] and Internet-Enabled Disk Images for use with the Apple utility Disk Copy, which was later 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.[16]

Currently, the only way to open a .dmg 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.{{citation needed|date=July 2011}}

See also

  • cloop
  • DiskImageMounter
  • Installer (macOS)
  • Sparse image

References

1. ^{{cite web|url=https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/hdiutil.1.html|title=hdiutil(1) Mac OS X Manual Page|accessdate=2016-05-14|deadurl=no|archiveurl=https://web.archive.org/web/20160514143638/https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/hdiutil.1.html|archivedate=2016-05-14|df=}}
2. ^{{cite web|url=http://support.apple.com/kb/ht4414|title=Software Downloads: Formats and Common Error Messages|accessdate=2009-05-06|deadurl=no|archiveurl=https://web.archive.org/web/20101224003344/http://support.apple.com/kb/HT4414|archivedate=2010-12-24|df=}}
3. ^{{cite web|url=http://support.apple.com/kb/ht1611|title=Mac OS X: Using Disk Copy disk image files|accessdate=2013-04-25|deadurl=no|archiveurl=https://web.archive.org/web/20131219230737/http://support.apple.com/kb/ht1611|archivedate=2013-12-19|df=}}
4. ^{{cite web|url=http://support.apple.com/kb/TA29157?viewlocale=en_US|title=DART 1.5.3: Version Change History|accessdate=2013-04-25|deadurl=no|archiveurl=https://web.archive.org/web/20131219231333/http://support.apple.com/kb/TA29157?viewlocale=en_US|archivedate=2013-12-19|df=}}
5. ^{{cite web|url=https://mjtsai.com/blog/2015/10/07/lzfse-disk-images-in-el-capitan/|title=LZFSE Disk Images in El Capitan|author=Michael Tsai|date=2015-10-07|accessdate=2017-04-09|deadurl=no|archiveurl=https://web.archive.org/web/20170409201500/https://mjtsai.com/blog/2015/10/07/lzfse-disk-images-in-el-capitan/|archivedate=2017-04-09|df=}}
6. ^{{cite web|url=http://newosxbook.com/DMG.html|title=Demystifying the DMG File Format|deadurl=no|archiveurl=https://web.archive.org/web/20130317050948/http://newosxbook.com/DMG.html|archivedate=2013-03-17|df=}}
7. ^{{cite web|url=http://crypto.nsa.org/vilefault/ |archive-url=https://web.archive.org/web/20070109011853/http://crypto.nsa.org/vilefault/ |dead-url=yes |archive-date=2007-01-09 |title=VileFault |publisher= |date=2006-12-29 |accessdate=2010-10-27 }}
8. ^{{cite web|url=http://vu1tur.eu.org/tools/ |title=dmg2img |publisher= |date= |accessdate=2010-10-27| archiveurl= https://web.archive.org/web/20101129080913/http://vu1tur.eu.org/tools/| archivedate= 29 November 2010 | deadurl= no}}
9. ^{{cite web|url=http://www.catacombae.org/dmgx.html|title=DMGExtractor|publisher=|date=|accessdate=2011-01-03|deadurl=no|archiveurl=https://web.archive.org/web/20110102225543/http://www.catacombae.org/dmgx.html|archivedate=2011-01-02|df=}}
10. ^{{cite web|author=MacDrive Features / Boot Camp / System Requirements / |url=http://www.mediafour.com/products/macdrive/ |title=MacDrive Home page |publisher=Mediafour |date= |accessdate=2010-10-27| archiveurl= https://web.archive.org/web/20101004143511/http://www.mediafour.com/products/macdrive/| archivedate= 4 October 2010 | deadurl= no}}
11. ^{{cite web|url=http://www.dataforensics.org/view-dmg-file/|title=Apple DMG Disk Image Viewer|publisher=DataForensics.org|date=2015-03-03|author=Olivia Dehaviland|accessdate=2015-03-10|deadurl=no|archiveurl=https://web.archive.org/web/20150402090851/http://www.dataforensics.org/view-dmg-file/|archivedate=2015-04-02|df=}}
12. ^{{cite web|url= http://www.davidtan.org/how-to-convert-dmg-to-iso-on-mac-osx-windows-and-linux/|title= How To Convert DMG To ISO in Windows, Linux & Mac|deadurl= no|archiveurl= https://web.archive.org/web/20100307231849/http://www.davidtan.org/how-to-convert-dmg-to-iso-on-mac-osx-windows-and-linux/|archivedate= 2010-03-07|df= }}
13. ^{{cite web|url=http://hydtech.wordpress.com/2009/01/29/how-to-convert-dmg-files-to-iso-using-poweriso/|title=Convert DMG To ISO using PowerISO|accessdate=2009-02-15|deadurl=no|archiveurl=https://web.archive.org/web/20090502185000/http://hydtech.wordpress.com/2009/01/29/how-to-convert-dmg-files-to-iso-using-poweriso/|archivedate=2009-05-02|df=}}
14. ^{{cite web|url=https://github.com/LubosD/darling-dmg|website=darling-dmg|accessdate=29 March 2015|title=darling-dmg}}
15. ^{{cite web|url=http://lists.apple.com/archives/cocoa-dev/2003/Oct/msg00642.html|title=Re: Some apps refuse to launch in 10.2.8! (OT, but very important)|deadurl=no|archiveurl=https://web.archive.org/web/20140117011736/http://lists.apple.com/archives/cocoa-dev/2003/Oct/msg00642.html|archivedate=2014-01-17|df=}}
16. ^{{cite web |url=https://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution4/Concepts/sd_disk_images.html |title=Guides |publisher=Apple |date= |accessdate=2010-10-27 |deadurl=no |archiveurl=https://web.archive.org/web/20090306142359/http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution4/Concepts/sd_disk_images.html |archivedate=2009-03-06 |df= }}

External links

  • Demystifying DMG A detailed discussion of the DMG file format and mounting it on iOS and Mac OS X
  • [https://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Concepts/sd_disk_images.html 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
  • {{apple man page|hdiutil}}
{{Archive formats}}{{Disk images}}

5 : Apple Inc. file systems|Archive formats|Compression file systems|Disk images|MacOS

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/12 16:18:16