Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't map file memory in MongoDB

Tags:

mongodb

The windows server 2003 box hosting our MongoDB instance ran out of disk space, and Mongo started generating the error:

Can't map file memory.

After adding additional disk space to the server and restarting the MongoDB windows service, any operation against the database still generates the "Can't map file memory" error. I tried doing a repair even and it gives the same error:

> db.repairDatabase(); { "assertion" : "can't map file memory", "assertionCode" : 10085, "errmsg" : "db assertion failure", "ok" : 0 }

Any idea what I can do to get my database operational again??

like image 478
Justin Avatar asked Nov 29 '11 15:11

Justin


2 Answers

Stopping the service, deleting the lock file, and then doing a mongod --repair worked, even though db.repairDatabase did not.

like image 182
Justin Avatar answered Oct 17 '22 10:10

Justin


The answer from Justin worked for me.

Here are some more detailed instructions for Ubuntu:

Stop Mongo Service: sudo service mongodb stop
Delete Lock File: sudo rm /var/lib/mongodb/mongod.lock
Repair the DB: sudo mongod --repair --dbpath=/var/lib/mongodb
Restart the Mongo Service: sudo service mongodb start

Hope that helps someone.

(edited - note that mongodb is the service name, but mongod is the correct command for repairing)

like image 28
Peter Johnson Avatar answered Oct 17 '22 11:10

Peter Johnson