Shrink MongoDB journal files

Eneko
enekochan
Published in
1 min readMay 6, 2014

Trying to get some space in my harddrive I noticed that the journal files of MongoDB where around 3GB.

Fixing this is as simple as stoping MongoDB server, adding the option smallfiles = true in /etc/mongodb.conf file, deleting the journal files and the starting the MongoDB service again.

sudo service mongodb stop
sudo vi /etc/mongodb.conf

At this moment you have to add this to /etc/mongodb.conf:

smallfiles = true

Now just delete the old journal files and restart the service. New journal files will be created:

sudo rm -rf /var/lib/mongodb/journal/*
sudo service mongodb start

Ref: http://lostquery.com/questions/313/how-do-i-shrink-the-mongodb-journal-files

--

--