Re: [mongodb-user] mongoDb , Excessive Disk Space

171 views
Skip to first unread message

Scott Hernandez

unread,
Aug 18, 2012, 7:28:12 AM8/18/12
to mongod...@googlegroups.com
I would suggest reading these to get a better understanding:

http://www.mongodb.org/display/DOCS/Excessive+Disk+Space
http://www.mongodb.org/display/DOCS/Durability+and+Repair
http://www.mongodb.org/display/DOCS/Compact+Command
http://docs.mongodb.org/manual/faq/storage/

On Sat, Aug 18, 2012 at 5:24 AM, sam <reds...@yahoo.com> wrote:
> my mongodb is taking 114G which is 85% of my disk
> trying to run :
> db.repairDatabase()
> will fail as i don't have enough disk space
> I know that my data shouldn't take this much space since
> i used to hold one big collection that took 90% of the disk
> then i drop this collection and reinserted only 20% of its data
>
> looking at the filesystem is noticed that /var/lib/mongo/_tmp is taking most
> of the space
> can i some how remove this there?
>
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb

sam

unread,
Aug 18, 2012, 8:35:36 AM8/18/12
to mongod...@googlegroups.com
Thanks mate , i read this already and it doesn't help 
db.repairDatabase  fails since it doesn't have enough space to work with. my disk is already 85% filled 
db.runCommand({compact:'myTable'})  This does not shrink any datafiles, however; it only defragments deleted space 

Exi

unread,
Aug 18, 2012, 9:38:49 AM8/18/12
to mongod...@googlegroups.com
Hi,
are there other collections in your database, or just one big collection?

sam

unread,
Aug 18, 2012, 9:50:02 AM8/18/12
to mongod...@googlegroups.com
just this one.

Exi

unread,
Aug 18, 2012, 10:32:22 AM8/18/12
to mongod...@googlegroups.com
In this case (I am using sharding) I usually drain the shard with the overfull disk until no more
chunks reside on the machine, then use mongodump and mongorestore to rebuild the database (which is
very fast, as it is empty). After that I remove the "draining" attribute from the shard in the
config database and wait for the rebalancing.
This helped me several times to minimize downtime and still be able to regain disk space.

Regards,
Exi

sam

unread,
Aug 18, 2012, 3:51:31 PM8/18/12
to mongod...@googlegroups.com
Thanks mate, 
I will do that , thanks for the help 

Reno Reckling

unread,
Aug 19, 2012, 2:15:48 AM8/19/12
to mongod...@googlegroups.com
Keep an eye on the moveChunk folder in you mongo directory,
backups of the moved chunks will be saved there, this should be moved/removed if you run low on disk
space, or the moveChunk files my overflow your disk.

MJ

unread,
Aug 19, 2012, 7:32:15 PM8/19/12
to mongod...@googlegroups.com
Hi Sam,

Are you running in a replica set? If so then you can "smash the glass" :).

I had a similar situation and I ended up stopping the mongo process, made sure a new primary had been selected, and then deleted all of the data files. I then started mongo back up and it did a resync with the primary but into a nice clean DB structure (no waisted space).

This is obviously extreme, hence "smash the glass", and should only be done if nothing else works.

Cheers,
MJ

sam

unread,
Aug 22, 2012, 8:28:28 AM8/22/12
to mongod...@googlegroups.com
Thanks MJ, 
im new to mongodb but from the answers i get it seems that this is the way to go 
10xs
Reply all
Reply to author
Forward
0 new messages