log: correct size output in disk space check #34305

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:fix_space_warning_log changing 1 files +1 −1
  1. fanquake commented at 12:26 pm on January 15, 2026: 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:

    0./build/bin/bitcoind -prune=40000
    1...
    22026-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.
    3Warning: 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:

    0./build/bin/bitcoind -prune=40000
    1...
    22026-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.
    3Warning: Disk space for "/root/.bitcoin/blocks" may not accommodate the block files. Approximately 39 GB of data will be stored in this directory.
    
  2. log: correct size output in disk space check
    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.
    ```
    2a42d39ea0
  3. DrahtBot added the label Utils/log/libs on Jan 15, 2026
  4. DrahtBot commented at 12:26 pm on January 15, 2026: contributor

    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, bensig

    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.

  5. in src/init.cpp:1934 in 2a42d39ea0
    1930@@ -1931,7 +1931,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
    1931                     "Approximately %u GB of data will be stored in this directory."
    1932                 ),
    1933                 fs::quoted(fs::PathToString(args.GetBlocksDirPath())),
    1934-                chainparams.AssumedBlockchainSize()
    1935+                (additional_bytes_needed / 1024 / 1024 / 1024)
    


    l0rinc commented at 12:35 pm on January 15, 2026:
    Might be worth noting that this will be capped to current blockchain max size: https://github.com/bitcoin/bitcoin/blob/2a42d39ea0de09d6bbd6852107c6c0fd8cc99d48/src/init.cpp#L1925
  6. l0rinc approved
  7. l0rinc commented at 12:39 pm on January 15, 2026: contributor

    tested ACK 2a42d39ea0de09d6bbd6852107c6c0fd8cc99d48

    With small prune values it shows the pruning value:

    0mkdir -p demo && cmake -B build && cmake --build build -j$(nproc) && ./build/bin/bitcoind -datadir=demo -prune=400000
    12026-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:

    0mkdir -p demo && cmake -B build && cmake --build build -j$(nproc) && ./build/bin/bitcoind -datadir=demo -prune=4000000
    12026-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.
    
  8. willcl-ark approved
  9. willcl-ark commented at 1:16 pm on January 15, 2026: member

    tACK 2a42d39ea0de09d6bbd6852107c6c0fd8cc99d48

    With 520GB free on /tmp I see:

    master:

    0❯ /run/current-system/sw/bin/bitcoind -daemon=0 -datadir=/tmp/size-warn -prune=600000
    1<snip>
    22026-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.
    3Warning: 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

    0❯ ./build/bin/bitcoind -daemon=0 -datadir=/tmp/size-warn -prune=600000
    1<snip>
    22026-01-15T13:13:51Z init message: Pruning blockstore…
    32026-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.
    4Warning: Disk space for "/tmp/size-warn/blocks" may not accommodate the block files. Approximately 585 GB of data will be stored in this directory.
    
  10. bensig commented at 7:34 pm on January 19, 2026: contributor
    ACK 2a42d39ea0de09d6bbd6852107c6c0fd8cc99d48

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-20 09:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me