What are “dmgpart” files and what tools can create, merge, or manage them

disk-utilitydmgutiUtilities

I downloaded something that came as three large files: One was a *.dmg (a disk image file, which I expected) and two more were *.dmgpart files, which I haven't happened to see before – I never downloaded something so large on my Mac!

I suppose these *.dmgpart files are just the parts of a single disk image, but spanning three files so each can fit within a target size for media backup purposes. For instance, the first two parts of my download were 4.3GB each, conspicuously the capacity of a single-layer DVD-ROM.

  1. Is my supposition about *.dmgpart files correct, or did I miss something key?

  2. How long ago were these multi-part disk image files introduced in Mac OS X?

  3. Is there a logical limitation to the *.dmg file format itself requiring images over a certain size to be made multi-part, or is it an optional facility for spanning media only?

  4. How can I create multi-part disk images like this? Is this supported by the standard tools (i.e. Disk Utility), or are special command-line or other tools required?

  5. Is there an easy way to merge the parts back into a single disk image? (One could conceive making the mistake of not copying an entire set – not a problem where only a single image file is involved.)

  6. Is there an easy way to split an existing very large disk image into a spanned set?

Thanks!

Best Answer

  1. Yes, you're correct. The hdiutil man page has a section on "segmented" files, disk images which are split across multiple files.

    Note that simply double-clicking on the first file should automatically mount the entire disk image, taking the others into account with no extra work!

  2. Looking at the old man pages, we can still see segmented disk image support way back in OS X 10.2 Jaguar. (Earlier man pages aren't available there, so it might have existed even earlier.) I'm not sure the extent of support for mounting them in the GUI, but I suspect it was functional back then as well.

  3. I'm not sure about the maximum size of a dmg file, but the man page mentions the limit for sparse images:

    The maximum size of a SPARSE image is 128 petabytes; the maximum for SPARSEBUNDLE is just under 8 exabytes (2^63 - 512 bytes minus 1 byte). The amount of data that can be stored in either type of sparse image is additionally bounded by the filesystem in the image and by any partition map.

    A sparse image expands as necessary when files are added to it, in contrast to a disk image which actually takes up as much space as you allocate for it.

    Basically, with modern filesystems that support very large files (8EB for HFS+), you're much more likely to hit disk capacity constraints than anything else. It might be more convenient to split your files for network transfers, DVD distribution (as you noticed), and the like.

  4. Disk Utility doesn't provide a GUI for creating these segments, but you can split an image using hdiutil directly from the command line. You specify the base filename and the size of each segment. An example, directly from the man page:

    hdiutil segment -segmentSize 10m -o /tmp/aseg 30m.dmg
    

    creates aseg.dmg, aseg.002.dmgpart, and aseg.003.dmgpart.

    I also found an application called DMGConverter which has a GUI for segmenting disk images.

  5. You can merge the files using hdiutil convert, for example:

    hdiutil convert firstFile.dmg -format UDRO -o output.dmg
    

    which will automatically include the .dmgparts.

  6. See #4.