ndif2raw



Apple has come up with quite a few disk image formats through the years:

  1. Disk Copy 4.2 / DART images
  2. NDIF images
  3. UDIF images
  4. sparse bundles

and surely others. The hdiutil(1) man page on macOS does a decent job explaining them.

For some reason, Apple removed the ability to read NDIF images in Big Sur.
This is annoying, since there's still plenty of old stuff out there on NDIF images that you might want to view.

For other formats like Disk Copy 4.2, people have already written standalone decoders. And although most of these disks contain standard (i.e., non-Plus) filesystems, Peter Hosey has written a great program called impluse to list/extract files from an HFS volume, or even to convert the volume over to HFS+. But I haven't been able to find anything publicly available for NDIF.

Well, NDIF is not too complicated a format. So I've written a converter, called ndif2raw. It doesn't yet support all flavors of NDIF, but it's working for the few images I've needed to convert. Specifically, it supports zero-filled, raw, and Apple Data Compression (ADC)-encoded chunks—but not (yet) KenCode.

The most complicated part of the NDIF format (and certainly the reason why it was replaced) is its use of the Macintosh resource fork. Currently, ndif2raw relies on Resource Manager routines to get the disk header. But there are open-source resource decoders out there, so I think a reasonable next step would be to incorporate something like that and allow this code to run anywhere with a C library.

Hopefully it'll be useful to someone.