Fix for mongod dead subsys locked error and Insufficient free space for journal files


This small tutorials explains about the fix for ubsys locked error and Insufficient free space for journal files and mongod is dead.

  • When this error occurs?

This error thrown When you start the server or server crashed with error - [initandlisten] ERROR: Insufficient free space for journal files

Due to this, Server crashed and down after this error.

SO you can check the status of mongo using below command

service mongod status

And it returns an error mongod dead but subsys locked

What is the reason for this error?

mongodb provides journal files used to write log failures for avoiding failures.

These journal files are saved to disk with path configured in mongodb.conf.

Mongodb background process generates the logs and writes to these files

by default, logs files are at \var\lib\mongo\journal folder.

These error occurs if there is no enough space to create a journal log files

Solution and fix

you need to add smallfiles=true option

smallfiles configuration allows to generate small default files of maximum size 512MB. Each journal file size reduce from 1GB to 512MB and avoid this error.

In mongo latest versions,

add the below configuration in /etc/mongod.conf

smallfiles=true

In older versions of mongodb, add the below in /etc/mongod.conf

3.x version

storage:
    mmapv1:
        smallFiles: true

2.6+ mongodb version

storage:
        smallFiles: true
        

Less than 2.4 mongodb version

       smallFiles: true  

Once you made the changes, You can either restart or stop and start

service mongod restart  —config /etc/mongod.conf

or 
service mongod stop
service mongod start  —config /etc/mongod.conf

You need to sudo to run above commands.

Conclusion

You learned how to Fix for mongod dead subsys locked error and Insufficient free space for journal files in mongodb linux

THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
Subscribe
You'll get a notification every time a post gets published here.