Fix for mongod dead subsys locked error and Insufficient free space for journal files
This post explains the fix for the subsys locked error and Insufficient free space for journal files and mongod is dead. You can also check Fix for digital envelope routines::unsupported
- When does this error occur?
This error is thrown When you start the server or the server crashed with the error - [initandlisten] ERROR: Insufficient free space for journal files
Due to this, the Server crashed and down after the error.
So you can check the status of mongo using the 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
.
The MongoDB background process generates the logs and writes to these files
by default, logs files are in \var\lib\mongo\journal folder.
This error occurs if there is not enough space to create journal log files
Solution and fix
you need to add the smallfiles=true
option
small files configuration allows generating small default files of a maximum size of 512MB. Each journal file size is reduced from 1GB to 512MB and avoid this error.
In mongo’s latest versions,
add the below configuration in /etc/mongod.conf
smallfiles=true
In older versions of MongoDB, add the below in /etc/mongod.conf
- using 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 the above commands.
Conclusion
You learned how to Fix for mongod dead subsys locked error and Insufficient free space for journal files in MongoDB Linux.