(This question is a spin-off of another question I asked on this site.)
New images always ignore owner/group
When creating a new disk image from Disk Utility it is automatically mounted. If you then select the volume in Finder and press Cmd-I (for the info window) you will see this at the bottom of the window:
This means that file owners and groups will be ignored on this volume. This is very convenient for external drives being shared between machines with different user accounts on them. For a backup volume it is not a good idea as you would like to retain the owner/group information for the files backed up.
Change this from Finder
To change this, simply uncheck the checkbox and it will remembered after you eject and remount the image.
Change from command line (Terminal)
Instead of mounting the image from Finder, you can also mount it from the command line using this command (assuming the image is called testimage.sparsebundle
):
$ hdiutil attach testimage.sparsebundle/
Still, owners are ignored on the volume. Adding the -owners on
option is (almost) equivalent to unchecking the checkbox in the image above:
$ hdiutil attach -owners on testimage.sparsebundle/
However, after unmounting and remounting the volume from Finder (or from the command line without the -owners on
option), the checkbox is checked again.
Does anybody know how to make this change persistent using a command-line call?