Ok, this was about to drive me crazy, and it seems like a lot of people have run into the same problem but sometimes my Mongo installation dies on me with an error like this:
10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Yeah, I didn’t get that either. The actual error is not hard to understand, there’s some kind of permission needed on the /data/db-directory. But why? And how to fix it?
Why… well in my case it was when I had to shut down a running VirtualBox image by just closing the image window, the equivalent of pulling the cord of a running computer. So probably Mongo didn’t have time to clean up after itself…
Fix it… yeah, there’s a big number of posts on StackOverflow, take your pick. This tip worked...