I'm trying out ec2-consistent-snapshot with --mongo --freeze-filesystem options. The snapshot itself works great.

However, after I restore the volume and try to use it with a new instance, when I launch mongodb I am getting this error:

old lock file: /db/mongodb/mongod.lock.  probably means unclean shutdown,
but there are no journal files to recover.
this is likely human error or filesystem corruption.
please make sure that your journal directory is mounted.

and mongo won't launch.

Is it safe to delete the mongod.lock file? Do I need to run a --repair? I can't find anything specific in the guide or the github repo - but maybe I'm missing something obvious...


The snapshot is made with the lock file. Normally MongoDB would delete the lock file on shutdown but as you have restored it, MongoDB thinks it was shut down unclean (in fact it wasn't shutdown at that moment).

The guide you provided states the following to start the server after a recover:

backup shell> chown -R mongodb /var/lib/mongodb/toyko0
backup shell> rm /var/lib/mongodb/tokyo0/mongod.lock
backup shell> mongod --dbpath /var/lib/mongodb/tokyo0

You have to change the paths of course but this clearly says that you delete the lockfile.

  • Thanks Christopher. That's what I thought, but this is something I really want to be extra sure about. Any references / resources to confirm this? Or is it so obvious it doesn't need to be documented anywhere? :) – Yoav Aner Aug 8 '13 at 6:38
  • It is more or less common sense and experience. You can prevent this error if you mount a special volume for the MongoDB database files and take a snapshot from this device only. This seems like the prettier way as well. – Christopher Perrin Aug 8 '13 at 11:33
  • I do mount a special volume for the mongo db and take a snapshot of this device only, but still get this error... Or do you mean set up mongo to put the mongod.lock file on another device/folder? – Yoav Aner Aug 8 '13 at 11:35
  • I just saw it. sorry. Can you change the path of the lockfile? (it shouldn't be in the snapshot) – Christopher Perrin Aug 8 '13 at 11:36
  • If you can't you can delete the lockfile. From my point of view it would be a waste of time because the snapshot took care of consistency. If you have any doubts about my words then you should run a repair. – Christopher Perrin Aug 8 '13 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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