5

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?

sblair
  • 12,617
  • 6
  • 48
  • 77
Olivier
  • 1,479
  • 4
  • 16
  • 22
  • 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. – Lri 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 Answers3

1

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

Brad Patton
  • 10,540
  • 12
  • 40
  • 68
Alex
  • 26
  • 1
0

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.

steve
  • 612
  • 4
  • 10
  • `sudo hdid android.sparsebundle`can 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
0

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.

Simon Sheehan
  • 9,114
  • 12
  • 52
  • 71
  • 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 07:00