3

I ran out of disk space on my mongo database. I saw it and dropped some collections (120 out of 1700 i had). And ran db.compact(...) thinking it would release free space. well, that was a stupid idea.

Anyway, the database is around 800GB, and I dont have any space (~5GB) in the current disk. I symlinked a folder from another disk that has around 35GB and tried db.repairDatabase() (and mongod --repair --repairpath ...), but that failed too saying not enough space. What else can I do? short of getting another 1TB HDD?

Why is even 35GB not enough? Since I dropped the collections, I know I should get another ~50GB free after the repair. Is that going to be enough?

The partition I use for data would have around ~800GB for mongo. How much free space should I ideally have?

Mongo says I need working set+2GB free space. But no queries are running and mongod stopped. So I'm not sure why 35GB is not enough.

2

There are two operations here
1. Compact - This is an in place compact of data inside the data files. This will however not release any of the data files. Even thought it does not return the free space to the file system mongo should be able to use the space for growth.
2. Repair - This will release any unused space back to the filesystem. This is what you need. However repair requires the same amount of space as your database. So if you want to repair you will 800GB + few extra GB for repair to complete.

0

If you have no space on the disk you should just simple dump the database, drop it and restore again.

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.