Mongo "prealloc" files taking up room
So in theory, the prealloc
files are preallocated journal files. This is opposed to in use journal files which have the format j._X
, where X
is a digit.
The goal here is to have "the next" file already allocated when the last file runs out of space. Pre-allocation is often much faster than on-demand allocation.
is it safe to delete these or move them?
The answer you seek is in the documentation here. The docs there seem to provide the key answer to your question:
prealloc files do not contain data, but are rather simply preallocated files that are ready to use that are truly preallocated by the file system (i.e. they are not "sparse"). It is thus safe to remove them, but if you restart mongod with journaling, it will create them again if they are missing.*
Add "smallfiles=true" in the MongoDB configuration file.