I have an encrypted drive on my mac - it's a dmg file under my home directory.

I mount it when I need to work on the files inside (obviously). In reality, this is "almost all the time". IE after I log in, I mount the drive, and there it stays.

The problem that I'm having is when for some reason I reboot my mac (and, possibly other times that I have not diagnosed yet) this drive appears to not get unmounted cleanly, and leaves a ghost folder in /Volumes.

That becomes a problem because when I mount it the next time, a folder with a different name is created in /Volumes, and then any paths I had that were pointing to the original no longer work (email client's email folder, for example).

How can I avoid this?

  • Note: I do not have the option to say "oh, my whole mac drive is encrypted, so I don't need this separate encrypted drive for this work". Practical realities aside, a policy dictates that I must have it – GreenAsJade Nov 26 '15 at 23:28
  • you can edit this to your question instead of adding a comment. – At0mic Nov 27 '15 at 1:13
  • 1
    Would mounting the DMG with a script work for you? It could automatically check for the directory before mounting, remove it, and then mount. Wouldn't be hard to write. I've had issues with this in the past, and my resolution was to just throw a script together as a workaround. Not pretty, but it works. – William T Froggard Nov 27 '15 at 1:19
  • I guess you're saying "have a script that removes the ghost first, then mounts". I could do that. Was kinda hoping to avoid the problem in the first place :) – GreenAsJade Nov 27 '15 at 3:27

You must log in to answer this question.

Browse other questions tagged .