I've reached a point where mongo fails to start because there's no enough free disk space. The log suggests using the --smallfiles option to start the mongod service.

So, I have two options, either make the hard drive bigger (it's an Amazon free instance) or doing what the mongodb log suggested.

Would data get corrupted if I enable --smallfiles for an existing mongo instance? I wouldn't want to lose any data.

  • fwiw: --smallfiles got removed in mongodb 4.2 anyways (just if someone is still looking for something like this). Sep 15, 2020 at 7:17

1 Answer 1


Straight to the point? The smallfiles option doesn't help. It doesn't automagically shrink existing files. All this option does is changing the behavior of how data files are preallocated.

Usually, the first datafile allocated has a size of 64MB. The next has 128MB. This doubling goes on until 2GB are reached. After that, every new datafile is allocated with 2GB.

The smallfiles option simply sets the initial size to 16MB, and the doubling starts from there.

You need either to increase disk space or start to shard.

  • Thanks Markus! Then I guess that, while it wouldn't actually fix my problem, smallfiles won't screw my existing data. I want to be sure about that because I might enable it after increasing disk space. Sep 15, 2015 at 2:53
  • @Silvestre the you didn't get me right. The smallfiles option won't help at all for existing databases. And for new ones, I heavily doubt it's use. You are saving a few MB at best. Most real world indices are much bigger. The smallfiles option was introduced for things like integration or cluster tests on space confined machines like VMs. Sep 15, 2015 at 8:12
  • 1
    Oh, no, I got you. I understand that it won't help me and I need to either increase the disk size or start sharding. I'm by no means a specialist on databases, I'm more like a monkey punching a keyboard and somehow I sometimes write code that mostly works. LOL. I just wanted to know if enabing the option would have any impact on existing data. Sep 15, 2015 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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