Blog/20120503 OS X volumes - hdiutil detach vs. Finder detach
A bit of a technical blog post, on something that was tricky to diagnose. It applies to OS X, version 10.7.3.
It seems that when a (newly created?) sparseimage is detached using
that some timestamps (of files in the sparseimage) change. I.e. if you check a timestamp, then use "hdiutil detach" and then reattach the image, then the timetamp is different (and has current time). So something seems to happen when "hdiutil detach" goes to work. "hdiutil" seems to "touch" some of the file, which changes the timestamp to current time.
However, if you eject the sparseimage via Finder, this doesn't seem to happen.
A work-around is to use Applescript (e.g. with osascript) to eject the sparseimage in that way. That seems to work.
EDIT. So there also seems to be an issue with cp/ditto/rsync preserving file stamps when copying. That's how I'd originally noticed that something was wrong, but then during testing had also discovered the above problem. It seems to potentially affect large files, potentially some types of files. What's going on? (This is when copying between different volumes on the commandline. Copying via Finder seems to be ok.)
2012-05-03 | Back to blog|