<p>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 <a href="https://github.com/bitcoin/bitcoin/blob/master/src/validation.h" rel="nofollow noreferrer">validations.h</a></p>

<pre><code>static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB
</code></pre>

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

<pre><code>static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB
</code></pre>

CC BY-SA 4.0
2020-04-16T13:39:16.330Z
2020-04-16T13:39:16.330Z
Allan Romanato
<p>In the bitcoind log there are many entries similar to this: </p>

<p><code>Pre-allocating up to position 0x200000 in rev02037.dat</code></p>

<p>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:</p>

<pre><code># 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
</code></pre>

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

<p>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?</p>

<bitcoind>
Is it possible to configure bitcoind to allocate blocks in larger "chunks"?
Emmanuel Rosa
# Is it possible to configure bitcoind to allocate blocks in larger "chunks"?

(Asked by: username_0 on 2020-04-16)

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?

**Tags:** bitcoind


---

## 1 answers

### Answer by username_1 on 2020-04-16. Score: 0 | Accepted answer

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](https://github.com/bitcoin/bitcoin/blob/master/src/validation.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

```


---

