<p>Ok, I think I got it.
Here is a short guide based on <a href="https://en.bitcoin.it/wiki/Data_directory#Transferability" rel="nofollow noreferrer">this bitcoin wiki article</a>.</p>

<p><strong>Notes:</strong></p>

<ol>
<li><strong>This does not concern backing up your keys</strong>. If you lost your wallet, or your keys, and you made the backup discussed here beforehand, <strong>this backup will not help you recover your lost coins</strong>. This will only save you some bandwidth/time/storage.</li>
<li>Don't load a database to your node unless you absolutely 100% trust the integrity of that database copy:</li>
</ol>

<blockquote>
  <p>when you copy someone's database in this way, you are trusting them
  absolutely. Bitcoin Core treats its block database files as 100%
  accurate and trustworthy, whereas during the normal initial sync it
  treats each block offered by a peer as invalid until proven otherwise.
  If an attacker is able to modify your block database files, then they
  can do all sorts of evil things which could cause you to lose
  bitcoins. Therefore, you should only copy block databases from Bitcoin
  installations under your personal control, and only over a secure
  connection.</p>
</blockquote>

<h2>Answers to the questions in the post</h2>

<ul>
<li>The directories that need to be (fully) copied are:

<ol>
<li><code>.bitcoin/blocks/</code></li>
<li><code>.bitcoin/chainstate/</code></li>
</ol></li>
<li>No extra steps needed to be done in order to just back-up the database. (<strong>This does not cover backing up your own bitcoin and keys</strong>, also there <strong>are</strong> extra steps in order to also load the database to another installation, read on to the next point)</li>
<li>In order to load a saved database to another installation, first <strong>delete the database of the target installation</strong>, than copy the backed up blockchain database files in their place.</li>
</ul>

<h2>Detailed guide</h2>

<p>I'm going to assume that you're in your target installation's folder (probably <code>~/.bitcoin</code>) so this is the time to do</p>

<p><code>cd /path/to/your/target/installation/folder/.bitcoin/</code></p>

<ol>
<li><p><strong>Back up your database:</strong></p>

<p>first, <strong>make sure this node is shut off</strong>. than make the backup:</p>

<p><code>tar cfz /path/to/your/backup/blockchain_database.tar.gz blocks/ chainstate/</code></p></li>
</ol>

<p>Now you have a backup of the database. You are probably going to take this backup to some other computer, or just keep it somewhere and than do the next steps when you want to load the database to some other node.</p>

<p>now again, <strong>make sure that the relevant node is shut off</strong>.</p>

<ol start="2">
<li><p><strong>Delete the target installation's database</strong></p>

<p><code>rm -r blocks/ chainstate/</code></p></li>
<li><p><strong>Extract the database from backup to target installation</strong>:</p>

<p><code>tar xfz /path/to/your/backup/blockchain_database.tar.gz</code></p></li>
</ol>

CC BY-SA 3.0
2017-12-14T18:04:34.247Z
2017-12-14T19:17:10.987Z
2017-12-14T19:17:10.987Z
talz
<p>Say I've received some Bitcoin using the <em>Bitcoin Core</em> wallet on some linux machine. Say I'm done playing for now.</p>

<p>So now I want to free some disk space by deleting the huge database from this machine (and maybe uninstalling the program after backing up <code>wallet.dat</code>?), but I do not want to have to download the whole blockchain again (which took <strong>forever</strong> the first time), so I want to back it up on some external drive, so I can just copy it back when I want to use <em>Bitcoin Core</em> again (on the same machine or on any other).</p>

<ul>
<li>What are all the files and directories that I need to copy?</li>
<li>Are there any extra steps needed to be done other than copying the files?</li>
<li>What are the steps to load the saved database to a new installation of <em>Bitcoin Core</em>?</li>
</ul>

<p>This will help me with my situation, but also, I thought our community could use such a guide posted here. Thanks!</p>

<bitcoin-core><wallet><database><bitcoin-qt-setup><storage-footprint>
How to save the bitcoin core (bitcoin-qt) database for later?
talz
# How to save the bitcoin core (bitcoin-qt) database for later?

(Asked by: username_0 on 2017-12-14)

Say I've received some Bitcoin using the *Bitcoin Core* wallet on some linux machine. Say I'm done playing for now.

So now I want to free some disk space by deleting the huge database from this machine (and maybe uninstalling the program after backing up `wallet.dat`?), but I do not want to have to download the whole blockchain again (which took **forever** the first time), so I want to back it up on some external drive, so I can just copy it back when I want to use *Bitcoin Core* again (on the same machine or on any other).

* What are all the files and directories that I need to copy?
* Are there any extra steps needed to be done other than copying the files?
* What are the steps to load the saved database to a new installation of *Bitcoin Core*?

This will help me with my situation, but also, I thought our community could use such a guide posted here. Thanks!

**Tags:** bitcoin-core, wallet, database, bitcoin-qt-setup, storage-footprint


---

## 1 answers

### Answer by username_0 on 2017-12-14. Score: 4 | Accepted answer

Ok, I think I got it.
Here is a short guide based on [this bitcoin wiki article](https://en.bitcoin.it/wiki/Data_directory#Transferability).

**Notes:**

1. **This does not concern backing up your keys**. If you lost your wallet, or your keys, and you made the backup discussed here beforehand, **this backup will not help you recover your lost coins**. This will only save you some bandwidth/time/storage.
2. Don't load a database to your node unless you absolutely 100% trust the integrity of that database copy:

> when you copy someone's database in this way, you are trusting them
> absolutely. Bitcoin Core treats its block database files as 100%
> accurate and trustworthy, whereas during the normal initial sync it
> treats each block offered by a peer as invalid until proven otherwise.
> If an attacker is able to modify your block database files, then they
> can do all sorts of evil things which could cause you to lose
> bitcoins. Therefore, you should only copy block databases from Bitcoin
> installations under your personal control, and only over a secure
> connection.

## Answers to the questions in the post

* The directories that need to be (fully) copied are:
  1. `.bitcoin/blocks/`
  2. `.bitcoin/chainstate/`
* No extra steps needed to be done in order to just back-up the database. (**This does not cover backing up your own bitcoin and keys**, also there **are** extra steps in order to also load the database to another installation, read on to the next point)
* In order to load a saved database to another installation, first **delete the database of the target installation**, than copy the backed up blockchain database files in their place.

## Detailed guide

I'm going to assume that you're in your target installation's folder (probably `~/.bitcoin`) so this is the time to do

`cd /path/to/your/target/installation/folder/.bitcoin/`

1. **Back up your database:**

   first, **make sure this node is shut off**. than make the backup:

   `tar cfz /path/to/your/backup/blockchain_database.tar.gz blocks/ chainstate/`

Now you have a backup of the database. You are probably going to take this backup to some other computer, or just keep it somewhere and than do the next steps when you want to load the database to some other node.

now again, **make sure that the relevant node is shut off**.

2. **Delete the target installation's database**

   `rm -r blocks/ chainstate/`
3. **Extract the database from backup to target installation**:

   `tar xfz /path/to/your/backup/blockchain_database.tar.gz`


---

