Skip to content

Conversation

@fanquake
Copy link
Member

The output should be the additional space needed, otherwise we are always warning that 810GB will be stored, even when a user is pruning.

For example on machine with ~20GB free disk, pruning to 40GB:

./build/bin/bitcoind -prune=40000
...
2026-01-15T11:45:33Z [warning] Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 810 GB of data will be stored in this directory.
Warning: Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 810 GB of data will be stored in this directory.

This PR:

./build/bin/bitcoind -prune=40000
...
2026-01-15T11:41:49Z [warning] Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 39 GB of data will be stored in this directory.
Warning: Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 39 GB of data will be stored in this directory.

The output should be the additional space needed, otherwise we are
always warning that 810GB will be stored, even when a user is pruning.

For example on machine with ~20GB free disk, pruning to 40GB:
```bash
./build/bin/bitcoind -prune=40000
...
2026-01-15T11:45:33Z [warning] Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 810 GB of data will be stored in this directory.
Warning: Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 810 GB of data will be stored in this directory.
```

This PR:
```bash
./build/bin/bitcoind -prune=40000
...
2026-01-15T11:41:49Z [warning] Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 39 GB of data will be stored in this directory.
Warning: Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 39 GB of data will be stored in this directory.
```
@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 15, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34305.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK l0rinc, willcl-ark

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #29678 (Bugfix: Correct first-run free space checks by luke-jr)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Contributor

@l0rinc l0rinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested ACK 2a42d39

With small prune values it shows the pruning value:

mkdir -p demo && cmake -B build && cmake --build build -j$(nproc) && ./build/bin/bitcoind -datadir=demo -prune=400000
2026-01-15T12:33:14Z [warning] Disk space for "[...]/bitcoin/demo/blocks" may not accommodate the block files. Approximately 390 GB of data will be stored in this directory.

For very big values it shows the current blocksdir size instead:

mkdir -p demo && cmake -B build && cmake --build build -j$(nproc) && ./build/bin/bitcoind -datadir=demo -prune=4000000
2026-01-15T12:33:45Z [warning] Disk space for "[...]/bitcoin/demo/blocks" may not accommodate the block files. Approximately 810 GB of data will be stored in this directory.

),
fs::quoted(fs::PathToString(args.GetBlocksDirPath())),
chainparams.AssumedBlockchainSize()
(additional_bytes_needed / 1024 / 1024 / 1024)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth noting that this will be capped to current blockchain max size:

std::min(chainman.m_blockman.GetPruneTarget(), assumed_chain_bytes) :

Copy link
Member

@willcl-ark willcl-ark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 2a42d39

With 520GB free on /tmp I see:

master:

❯ /run/current-system/sw/bin/bitcoind -daemon=0 -datadir=/tmp/size-warn -prune=600000
<snip>
2026-01-15T13:16:00Z [warning] Disk space for "/tmp/size-warn/blocks" may not accommodate the block files. Approximately 810 GB of data will be stored in this directory.
Warning: Disk space for "/tmp/size-warn/blocks" may not accommodate the block files. Approximately 810 GB of data will be stored in this directory.

PR

❯ ./build/bin/bitcoind -daemon=0 -datadir=/tmp/size-warn -prune=600000
<snip>
2026-01-15T13:13:51Z init message: Pruning blockstore…
2026-01-15T13:13:51Z [warning] Disk space for "/tmp/size-warn/blocks" may not accommodate the block files. Approximately 585 GB of data will be stored in this directory.
Warning: Disk space for "/tmp/size-warn/blocks" may not accommodate the block files. Approximately 585 GB of data will be stored in this directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants