Uint32_t SegmentNumber // Usually 1, may be 0 Uint64_t RsrcForkLength // Resource fork length, if any Uint64_t RsrcForkOffset // Resource fork offset, if any Uint64_t DataForkLength // Size of data fork (usually up to the XMLOffset, below) Uint64_t DataForkOffset // Data fork offset (usually 0, beginning of file) Uint32_t HeaderSize // sizeof(this), always 512 The koly block, when present, is formatted according to the following: Images created with the DiscRecording.Framework contain the koly block. In those cases, however, there is nothing special or noteworthy about the file, which can be read as any disk would, by its partition table (commonly APM, or GPT). Note, that "most" is not "all": images created with hdiutil(1), for example, can simply be raw dd(1)-like images of the disk layout, with no metadata. As other references to this trailer call it the "koly" block, we can do the same. This trailer is identifiable by a magic 32-bit value, 0圆B6F6C79, which is "koly" in ASCII. The common denominator of most of these is the existence of a 512-byte trailer at the end of the file. DMGs come in a variety of sub-formats, corresponding to the different tools which create them, and their compression schemes. The first noteable fact about the DMG file format is, that there is no DMG file format. When set to verbose mode, HFSleuth also provides step by step information as it processes DMGs, and is used in the examples below.
#Create dmg files portable#
HFSleuth can operate fully on all known DMG types (to date), and can serve as a complementary tool to Apple's hdiutil(1), or - as it is POSIX portable - even as a replacement for it, on non OS X systems. The DMG file format has been painstakingly reverse-engineered by several, and this article/addendum aims to consolidate their hard work into a single document. This article, therefore, is an attempt to rectify that shortcoming.
I briefly mention DMGs (pages 589-590), but due to the page constraints of an already large book, I had failed to delve into their format sufficiently. I realized, however, that the DMG file format (being Apple proprietary) was woefully undocumented. AboutĪs part of writing HFSleuth, a "bonus" tool for my book, I decided to implement DMG (disk image support). DeMystifyinG the DMG file format Demystifying the DMG File Format Jonathan Levin, - 6/12/13 1.