0

I want to find the size of the blockchain data. I've been using this Linux command:

du --exclude=index /home/me/.bitcoin/blocks/

Is this the most accurate way to do it? And does dividing the result by 1024/1024 give the size of the blockchain in GBs?

Note: The --exclude=index part excludes the blocks/index/ subfolder, which I've heard is extra metadata used for levelDB to make it faster to search through the blockchain. I just want to know the size of the blockchain data only, so does it make sense to omit this?

1 Answer 1

2

du rounds up file sizes to the next multiple of your filesystem's block size. It also includes the sizes of directories. So this will give you a (slight) overestimate.

You really just want to add up the total sizes of all the blk*.dat files. You can get that with

du -c --apparent-size /home/me/.bitcoin/blocks/blk*.dat

You can divide this number by 1000000000 to get GB, or by 1024*1024*1024 to get GiB (note the distinction).

Note that this will still include "orphan" blocks that you downloaded and stored, but that are not part of the main block chain. There isn't any easy way to exclude those, as far as I know.

3
  • Thanks Nate. I'm going to display the size of the blockchain on a website. In your opinion, would it make more sense to use GB or GiB?
    – inersha
    Commented Aug 1, 2016 at 15:57
  • I don't have an opinion on that. Commented Aug 1, 2016 at 16:02
  • @inersha: GiB is less ambiguous. When you write GB, especially in the context of storage capacity some might understand it as 10^9 bytes while others think you mean 2^30.
    – Murch
    Commented Aug 3, 2016 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.