Limit the disk space consumed by Bitcoin Core nodes on Linux

Mattias Geniar, Monday, February 25, 2019

If you run a Bitcoin Core node, by default it will download the entire blockchain on startup and keep a list of every block & transaction. If you're limited in diskspace, you can instruct the Bitcoin Code daemon to limit the amount of storage the blockchain will take up.

I'll assume the Bitcoin Core blockchain is being kept at /home/bitcoin/.bitcoin/. If you run your node as a different user, look for the .bitcoin hidden directory in your home directory.

In there, either a bitcoin.conf file already exists, or you can create one.

To limit the amount of diskspace being consumed, set the prune directive.

$ cat /home/bitcoin/.bitcoin/bitcoin.conf

The prune= accepts as a parameter the size in MB's that you want to keep. This example above limits the blockchain to 1GB (= 1000MB).

There's a caveat to limiting the diskspace those, as explained by the manual;

-prune=n: This mode is incompatible with -txindex and -rescan. Warning: Reverting this
setting requires re-downloading the entire blockchain. (default: 0 = disable pruning blocks,
1 = allow manual pruning via RPC, >550 = automatically prune block files to stay under the
specified target size in MiB)

It makes sense, too: if the entire blockchain isn't present on the local disk, you also can't use all the tools that require the local blockchain to be complete.

Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek & public speaker. Currently working on DNS Spy & Oh Dear!. Follow me on Twitter as @mattiasgeniar.

Share this post

Did you like this post? Will you help me share it on social media? Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *