Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to use a case-sensitive and encrypted disk-image for my development work. I need some folders inside it to be Dropbox-ed (using symlinks). However if I accidentally unmount the dmg, Dropbox erases everything in the cloud.

Therefore I need to prevent unmounting of this disk image (mounted at boot). Ideally it would require my session password when I click on the eject icon in the finder. Any ideas?

share|improve this question
    
Cheap solution, but you could just put any small app (probably a dummy workflow) on that disk image, and start it. Finder won't unmount unless that app is quit. –  slhck Nov 21 '11 at 12:33
1  
A workaround could be to mount the dmg with hdiutil attach -nobrowse some.dmg. It would only be shown in /Volumes/, not in Finder's sidebar or on the desktop. –  ؘؘؘؘ Nov 21 '11 at 14:17
    
hdiutil attach -nobrowse some.dmg seems really interesting, tried to drag back the iso to the tabbar but it adds back the eject button. I guess i could find my way with symlinks somehow. –  Olivier Nov 22 '11 at 22:58

3 Answers 3

up vote 1 down vote accepted

I use a ramdrive for a lot of work, so I've had to find a way to prevent accidental ejection.

My solution is similar to @slhck's.

  1. Open up a terminal.
  2. Open up a screen session.
  3. cd into the disk image you want to protect.
  4. Disconnect from that screen session (Ctrl-A and then D usually does the trick).

Finder will not immediately eject the volume, but will ask you if you want to force an eject.

The only caveat here is that I don't think screen comes with normal OS X, you'll need MacPorts to

share|improve this answer

If I were you, I would mount it as an escalated user (root)

You can indeed use sudo to mount a device in OSX. I have not had a chance to see if it behaves the same way as in Unix because I dont have OSX. This should indeed force you to enter the password again to unmount it, correct?

At that point file permissions need to be set correctly. But it should not be unmountable except by an escalated user or issuing sudo.

share|improve this answer
    
sudo hdid android.sparsebundlecan be unmount without elevation :(. Maybe there is another way/cmd to mount the drive but i guess it would not change that elevation thing... Was worth a try, thanks anyway ;). –  Olivier Nov 22 '11 at 22:55
    
Thats what i was afraid of man. I know it works this way in *nix. but a lot was simplified and changed in osx. If I can come up with a solution ill keep you updated. good luck –  steve Nov 22 '11 at 23:24

You could do it the other way around - Keep the files in Dropbox and symlink them into your encrypted disk. Then Dropbox won't delete the files when you umount the disk and you still can access the files from your dev env.

share|improve this answer
1  
Probably due to missing case sensitivity of the main partition. File names will conflict. Assuming missing encryption is not an issue. –  Daniel Beck Nov 23 '11 at 7:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.