Mongo::Error::NoServerAvailable OR mongod stoped working rails OR Insufficient free space for journals, terminating

First I tried to remove mongod lock, but it did not worked:

sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb restart

Then I tried to change permission for “/tmp” folder

ls -lh /tmp
chown root:root /tmp
chmod 1777 /tmp
sudo service mongodb restart
tail -f /var/log/mongodb/mongod.log

It did not worked but guided me towards the problem.


Insufficient free space for journal file
Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles
Insufficient free space for journals, terminating
now exiting #It means mongo is stopping itself
shutdown: going to close listening sockets...
removing socket file: /tmp/mongodb-27017.sock


sudo nano /etc/mongod.conf

and add

      smallFiles: true

Now specify for mongod to “Use the Configuration File” using command below

mongod -f /etc/mongodb.conf

In other terminal tab open log file

tail -f /var/log/mongodb/mongod.log

Restart mongod

sudo service mongod restart

log file will contain “connection now open” if everything is fine.

Side Notes:
1. To check mongod install version

mongod --version

2. mongod.conf other options

# Where and how to store data.
  dbPath: /var/lib/mongodb
    enabled: true
#  engine:
   smallFiles: true  #OPTION ADDED FOR SMALL FILES
#  wiredTiger:

# where to write logging data.
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
  port: 27017
Mongodb Small file options setting for different versions


I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Tagged with: , , ,
Posted in mongodb, mongoid

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: