<p><code>du</code> 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.</p>

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

<pre><code>du -c --apparent-size /home/me/.bitcoin/blocks/blk*.dat
</code></pre>

<p>You can divide this number by 1000000000 to get GB, or by 1024*1024*1024 to get GiB (<a href="https://en.wikipedia.org/wiki/Gibibyte" rel="nofollow">note the distinction</a>).</p>

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

CC BY-SA 3.0
2016-08-01T15:57:19.763Z
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
CC BY-SA 3.0
2016-08-01T16:02:15.850Z
I don't have an opinion on that.
Nate Eldredge
CC BY-SA 3.0
2016-08-03T06:08:46.267Z
@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
CC BY-SA 3.0
2016-08-01T15:28:32.853Z
2016-08-01T15:28:32.853Z
Nate Eldredge
<p>I want to find the size of the blockchain data. I've been using this Linux command:</p>

<p><code>du --exclude=index /home/me/.bitcoin/blocks/</code></p>

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

<blockquote>
  <p><strong>Note:</strong> The <code>--exclude=index</code> 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?</p>
</blockquote>

<blockchain><storage-footprint>
How to calculate the size of the blockchain?
inersha
# How to calculate the size of the blockchain?

(Asked by: username_0 on 2016-08-01)

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?

**Tags:** blockchain, storage-footprint


---

## 1 answers

### Answer by username_1 on 2016-08-01. Score: 2 | Accepted answer

`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](https://en.wikipedia.org/wiki/Gibibyte)).

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.

> **Comments:**
> **username_0**: Thanks username_1. 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?  
> **username_1**: I don't have an opinion on that.  
> **username_2**: @username_0: 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.  

---

