Is there a way to automatically unmount a specific volume (mounted from a .dmg/.sparseimage) if it has not been accessed for a specified period?
EDIT:
-
This would be especially useful for password protected images which contain sensitive data.
-
Since I got no complete answer to this, I have asked a similar but simpler question here.
Best Answer
The OS doens't allow that out of the box (neither for dmg nor real partitions).
What I would do is create a script that would listen to that mounted image and after x time idle, unmount it.
Applescript is a fairly simple way to get that working (or via an automator flow).
Some pointers:
(the tricky part is getting the disk image idle)
http://www.mactech.com/articles/mactech/Vol.20/20.07/FolderWatching/index.html
http://webcache.googleusercontent.com/search?q=cache:IjvM1V_MxroJ:macscripter.net/viewtopic.php%3Fid%3D39468+&cd=4&hl=en&ct=clnk&client=safari
Checking for folder/file changes using Automator?
How to run Applescript on Disk mount
Automatically launch a program or action when an external drive or disk is connected
I'll make an example later today, but the flow will be like this: