Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why getting error mongod dead but subsys locked and Insufficient free space for journal files on Linux?

I have installed mongo-10gen mongo-10gen-server on Linux CentOS server.

I followed the steps from Link.

I have configured /etc/mongod.conf as -

logpath=/var/log/mongo/mongod.log port=27017 dbpath=/var/lib/mongo 

I have set port 27017 for mongo in iptables. To start mongo I used commands -

service mongod start and mongo 

It get started well, but after few days I am getting the error -

Tue Jan 29 08:41:54 [initandlisten] ERROR: Insufficient free space for journal files Tue Jan 29 08:41:54 [initandlisten] Please make at least 3379MB available in /var/lib/mongo/journal or use --smallfiles Tue Jan 29 08:41:54 [initandlisten] Tue Jan 29 08:41:54 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating Tue Jan 29 08:41:54 dbexit: Tue Jan 29 08:41:54 [initandlisten] shutdown: going to close listening sockets... Tue Jan 29 08:41:54 [initandlisten] shutdown: going to flush diaglog... Tue Jan 29 08:41:54 [initandlisten] shutdown: going to close sockets... Tue Jan 29 08:41:54 [initandlisten] shutdown: waiting for fs preallocator... Tue Jan 29 08:41:54 [initandlisten] shutdown: lock for final commit... Tue Jan 29 08:41:54 [initandlisten] shutdown: final commit... Tue Jan 29 08:41:54 [initandlisten] shutdown: closing all files... Tue Jan 29 08:41:54 [initandlisten] closeAllFiles() finished Tue Jan 29 08:41:54 [initandlisten] journalCleanup... Tue Jan 29 08:41:54 [initandlisten] removeJournalFiles Tue Jan 29 08:41:54 [initandlisten] shutdown: removing fs lock... Tue Jan 29 08:41:54 dbexit: really exiting now 

When I execute the command -

service mongod status 

It gives Error -

mongod dead but subsys locked 

Please help me to solve the problem of mongod dead but subsys locked and Insufficient free space for journals, terminating

like image 420
Deepu Avatar asked Jan 29 '13 13:01

Deepu


2 Answers

You can add following to the config file provided when running mongod --config mongod.conf

For MongoDB 3.x (latest version)

storage:    mmapv1:       smallFiles: true 

For version 2.6+

storage:    smallFiles: true 

For version 2.4 and less

smallfiles = true 

Then just execute mongod to accept your config file (here it assumes that location of the config is /etc/mongodb.conf):

mongod -f /etc/mongodb.conf 

Documentation for smallfiles parameter:

Set to true to modify MongoDB to use a smaller default data file size.  Specifically, smallfiles reduces the initial size for data files and limits them to 512 megabytes. The smallfiles setting also reduces the size of each journal files from 1 gigabyte to 128 megabytes. 
like image 101
Andrei Karpushonak Avatar answered Sep 23 '22 09:09

Andrei Karpushonak


Start mongod instance using following command

mongod --dbpath /data/db --smallfiles 
like image 30
Rajkumar Singh Avatar answered Sep 23 '22 09:09

Rajkumar Singh