Skip to content

Instantly share code, notes, and snippets.

@jyap808
Created April 8, 2014 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyap808/10189278 to your computer and use it in GitHub Desktop.
Save jyap808/10189278 to your computer and use it in GitHub Desktop.
Shrink MongoDB journal files

In the MongoDB configuration file add the following line:

smallfiles=true

The safety shut off MongoDB and remove the journal files.

Full procedure:

sudo cp -p /etc/mongod.conf{,.BAK}
sudo vi /etc/mongod.conf

sudo /etc/init.d/mongod stop
sudo rm -rf /var/lib/mongodb/journal/*
sudo /etc/init.d/mongod start

All the files in /var/lib/mongodb/journal/ are recreated when mongodb starts.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment