My Mongo version is 2.6.9

I have an application that is inserting, reading and removing data from Mongo. That's all working fine. However the disk space increases exponentially. My HDD is around 120 GB, and Mongo consumes about 100GB.

I checked the collection to see what was consuming so much data. I couldn't do a "repair database" because of disk space. So I removed my database completely:

mongodump -d db
echo 'db.dropDatabase()' | mongo db
mongorestore /root/bashscript/backups/dump/db

I re-imported all the old documents, except from the collection that was consuming so much data. I recreated this collection with compact and power of 2 sizes (because that should do the trick).

Now when I add new data into this collection (around 200.00 docs), the result is the same, the collection is using 80GB of data.

What am I doing wrong? Am I using Mongo DB incorrectly? Is it not a good idea to use Mongo DB in my situation? I don't understand why Mongo is consuming so much disk space.

Here is the output of db.stats();

  "db" : "secret",
  "collections" : 13,
  "objects" : 1270459,
  "avgObjSize" : 1626.300957370525,
  "dataSize" : 2066148688,
  "storageSize" : 2616651776,
  "numExtents" : 97,
  "indexes" : 39,
  "indexSize" : 496086976,
  "fileSize" : 4226809856,
  "nsSizeMB" : 16,
  "dataFileVersion" : {
    "major" : 4,
    "minor" : 5
  "extentFreeList" : {
    "num" : 0,
    "totalSize" : 0
  "ok" : 1

Update responding to answers so far: I can't update to Mongo 3.0, because the database is used in production. But I guess the solution is upgrade to Mongo 3.0 and this should resolve the problem?

  • There is something very, very strange. As per your db.stats output, the size on disk should be 42Gb. Do you have a replica set or oplog enabled manually? If yes, keep in mind that MongoDB allocates 5% of the available space for the oplog. Any other databases? Curiouser and curiouser... – Markus W Mahlberg Nov 19 '15 at 21:40

Can you upgrade to MongoDB 3.0 ? If yes, you can run your Mongo instance with WiredTiger. This storage engine compresses your data and this should significantly use your disk usage. If you use Snappy, the default compression algorithm you should typically observe a compression ratio around 70%, although this depends on your document data types.


Regarding concerns about mongodb data storage on HDD I suggest you to upgrade your mongodb version to 3.0 new storage engine wiredTiger is available in mongodb 3.0 which has lots of benefits as compared to MMAPv1 storage engine .

WiredTiger uses compression algorithms such as snappy,zlib and along with it Indexes also use compression with wiredTiger as storage engine in MongoDB consequently reducing disk size of mongo database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.