I'm trying to use DMG files for a sort of DIY union FS, or snapshot, scenario.

That is, I create a compressed UDF disk image with hdiutil, like hdiutil create -format ULFO -volname "$name" -srcfolder /Volumes/scratch/"$name" "$name.dmg", and then mount it with a shadow file in order to capture the tiny expected changes that might be written to it (something like perhaps a megabyte or two of changes, in newly created files, not changes to existing files in the image).

E.g., hdiutil attach -noverify -mountpoint "$name" "$name.dmg" -shadow "$name.shadow". This will initially create a very small shadow file of about 6 megabytes.

What I've noticed is that the shadow file will very quickly start to grow, massively so, simply by accessing the mounted image. E.g. doing find $name -type f -exec dd if={} of=/dev/null \; will read all files inside the image, and this will result in a shadow file that is the same size as the DMG itself. The shadow file also doesn't compress well, indicating that the shadow file is actually being filled by copied reads from the DMG, which makes zero sense to me considering that the -shadow is meant to support the documented behavior that All data written to an attached device will be redirected to the shadow file.

This feels like a bug, but perhaps I'm just missing something. My Google fu is failing me, so here I am with this question.


This is on El Capitan, FYI.

You must log in to answer this question.

Browse other questions tagged .