In the bitcoind log there are many entries similar to this:

Pre-allocating up to position 0x200000 in rev02037.dat

There are often several messages regarding pre-allocation of the same file. This is concerning because copy-on-write filesystems (such as BTRFS, in my case) have to allocate new extents when files are written in this manner. Such writes cause an increase in filesystem metadata block consumption, which of course eats away at the overall available storage. For example, here are the size and number of extents consumed by two of the files:

# ls -lh *02036.dat
-rw------- 1 bitcoin bitcoin 128M Apr 16 16:49 blk02036.dat
-rw------- 1 bitcoin bitcoin  17M Apr 16 16:49 rev02036.dat

# filefrag *02036.dat
blk02036.dat: 87 extents found
rev02036.dat: 103 extent found

Both files consume more extents than what they actually need considering their sizes. After defragging them with btrfs filesystem defrag they were rewritten and now only consume one extent each.

Since the blk and rev files each tend to be roughly the same size, I prefer to have bitcoind perform the allocations such that it's most likely to only need to perform one pre-allocation. Is there such a configuration option available?


If you referring to the blkxxx.dat file it will always have a maximum size of 128 MB which is defined in the bitcoin the source file validations.h

static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB

Also in this file you can see that the maximum pre-allocation chunk size fixed.

static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB

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.