MongoDB Documentation, Release 3.0.4 Step 1: Start mongod using the option to replace the original files with the repaired files. Start the mongod instance using the --repair option and the --repairpath option. Issue a command similar to the following: mongod --dbpath /data/db --repair --repairpath /data/db0 When this completes, the new repaired data files will be in the /data/db0 directory. Step 2: Start mongod with the new data directory. Start mongod using the following invocation to point the dbPath at /data/db0 : mongod --dbpath /data/db0 Once you confirm that the data files are operational you may delete or archive the old data files in the /data/db directory. You may also wish to move the repaired files to the old database location or update the dbPath to indicate the new location. Step 1: Remove the stale lock file. For example: rm /data/db/mongod.lock Replace /data/db with your dbPath where your MongoDB instance’s data files reside. Step 2: Start mongod using the option to replace the original files with the repaired files. Start the mongod instance using the --repair option, which replaces the original data files with the repaired data files. Issue a command similar to the following: mongod --dbpath /data/db --repair When this completes, the repaired data files will replace the original data files in the /data/db directory. Step 3: Start mongod as usual. Start mongod using the following invocation to point the dbPath at /data/db : mongod --dbpath /data/db In normal operation, you should never remove the mongod.lock file and start mongod . Instead consider the one of the above methods to recover the database and remove the lock files. In dire situations you can remove the lockfile, and start the database using the possibly corrupt files, and attempt to recover data from the database; however, it’s impossible to predict the state of the database in these situations. If you are not running with journaling, and your database shuts down unexpectedly for any reason, you should always proceed as if your database is in an inconsistent and likely corrupt state. If at all possible restore from backup (page 184) or, if running as a replica set , restore by performing an initial sync using data from an intact member of the set, as described in Resync a Member of a Replica Set (page 633). mongod.lock 5.2.3 MongoDB Scripting The mongo shell is an interactive JavaScript shell for MongoDB, and is part of all MongoDB distributions$^{107}$. This section provides an introduction to the shell, and outlines key functions, operations, and use of the mongo shell. Also consider FAQ: The mongo Shell (page 756) and the shell method and other relevant reference material . $^{107}$http://www.mongodb.org/downloads 265 5.2. Administration Tutorials