Reclaim Mongodb Diskspace

Mongodb chews through disk space.  Even our lightly used servers need to be cleared out every couple of months.  The new usePowerOf2Sizes flag has helped but it hasn’t eliminated our need to perform a full --repair every once in a while.  Unfortunately, the process requires downtime and even more free space than Mongo has consumed, but after mounting a temporary volume (i.e. /mnt below) it will compact all databases and release a significant portion of the disk.

sudo mongod --config /etc/mongo.conf --shutdown
sudo mongod --config /etc/mongo.conf --repair --nojournal --repairpath /mnt

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s