
This post explains the fix for the ubsys locked error and Insufficient free space for journal files and mongod is dead.
- When does this error occur?
This error is thrown When you start the server or server crashed with error - [initandlisten] ERROR: Insufficient free space for journal files
Due to this, the Server crashed and down after this 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
.
MongoDB background process generates the logs and writes to these files
by default, logs files are at \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 maximum size 512MB. Each journal file size is reduced 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
- 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 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.