<p>Unless explicitly told otherwise, the <code>datadir</code> is always placed in <code>/home/$USER/.bitcoin</code>, there is no logic for automatically using any location other than this. The configuration file is always in the data directory as <code>bitcoin.conf</code>. </p>

CC BY-SA 4.0
2020-02-20T20:17:38.090Z
2020-02-20T20:17:38.090Z
Claris
<p>One of the ways of pointing to your data directory is making a change to your bitcoin.conf file (it's usually located in  <code>~/.bitcoin/bitcoin.conf</code> path)
Add the line:</p>

<blockquote>
  <p>datadir = /path_to_your_data_directory</p>
</blockquote>

<p>If you're on raspberry Pi I highly suggest reading through the <code>Raspibolt</code> documentation, it's step by step installation guide, linking specific chapter related to your question below:
<a href="https://stadicus.github.io/RaspiBolt/raspibolt_30_bitcoin.html#prepare-data-directory" rel="nofollow noreferrer">https://stadicus.github.io/RaspiBolt/raspibolt_30_bitcoin.html#prepare-data-directory</a></p>

CC BY-SA 4.0
2020-02-20T20:18:01.940Z
3 second delta has got to be some sort of new record.
Claris
CC BY-SA 4.0
2020-02-20T20:17:35.193Z
2020-02-20T20:18:26.063Z
2020-02-20T20:18:26.063Z
Tony Sanak
<p>When you start bitcoind, you can specify a non-default data directory:</p>

<p><code>$ bitcoind datadir=/your/custom/filepath</code> </p>

<p>This will override the option set in the <code>bitcoin.conf</code> file, if there is one set there. </p>

CC BY-SA 4.0
2020-02-21T02:15:24.530Z
2020-02-21T02:15:24.530Z
chytrik
<p>here i have some example script for UTX token ( bitcoind and the friend ) </p>

<p><a href="https://github.com/sicute/blockchain" rel="nofollow noreferrer">example script and manage blockchain</a></p>

<p>also in that script include block monitoring using bash and qt compare with public blockchain explore node </p>

CC BY-SA 4.0
2020-02-22T01:04:46.270Z
2020-02-22T01:04:46.270Z
sonjaya sonjaya
<p>The SD card on a Raspberry Pi will not be large enough to accommodate the Bitcoin blockchain.  However, by default the data directory will be /home/$USER/.bitcoin which is on the SD card.  One way to change this to a data directory on an external hard disk drive would be to create a symbolic link to the new directory, as follows:</p>
<p>ln -s /mnt/ext/bitcoin /home/$USER/bitcoin/.bitcoin</p>
<p>Correct the above line to accommodate your pathways.</p>

CC BY-SA 4.0
2024-07-22T04:37:13.277Z
Sandisk does make 1TB sd cards, even 1.5TB. That is more than enough to accomodate the Bitcoin blockchain.
apchrkey
CC BY-SA 4.0
2021-09-16T08:32:04.043Z
2021-09-16T08:32:04.043Z
Glen
<p>The default location for the data directory in Bitcoin Core depends on the host OS:</p>
<h2>On Linux</h2>
<ul>
<li>if <code>$HOME</code> is set and non-empty: <code>$HOME/.bitcoin</code></li>
<li>otherwise <code>/.bitcoin</code></li>
</ul>
<h2>On MacOS:</h2>
<ul>
<li>if <code>$HOME</code> is set and non-empty: <code>$HOME/Library/Application Support/Bitcoin</code></li>
<li>otherwise <code>/Library/Application Support/Bitcoin</code></li>
</ul>
<h2>On Windows:</h2>
<ul>
<li>Until v28: <code>%APPDATA%\Bitcoin</code> which is by default <code>%USERPROFILE%\AppData\Roaming\Bitcoin</code> which is by default <code>C:\Users\&lt;username&gt;\AppData\Roaming\Bitcoin</code></li>
<li>Starting with v28: <code>%LOCALAPPDATA%\Bitcoin</code> (<code>%USERPROFILE%\AppData\Local\Bitcoin</code>, <code>C:\Users\&lt;username&gt;\AppData\Local\Bitcoin</code>)</li>
</ul>
<p><a href="https://github.com/bitcoin/bitcoin/blob/master/src/common/args.cpp#L697-L727" rel="nofollow noreferrer">Source</a></p>

CC BY-SA 4.0
2024-07-21T13:19:24.073Z
2024-07-21T13:28:04.310Z
2024-07-21T13:28:04.310Z
nikicat
<p>Sorry, noob question I am new to anything linux related. I managed to set up bitcoin core just fine on my raspberry pi 4 and I have an external HDD that I want to use as my data directory for the 250 GB or so of blocks (this is not my main storage that I boot from). </p>

<p>Problem is, I have absolutely no idea how the bitcoind program decides on its data directory. I have run 3 or 4 times and I have 3 or 4 different data directories, none of which are on the HDD. How do I tell it where to store the data? Also, where do I put the bitcoin.conf file because it can never seem to find it. I have most of the blockchain pre-installed on my HDD from my windows pc and so I would ideally use that same directory but if thats not possible thats fine, I at least want it on my HDD though. I have followed several guides and nothing has worked for me so far. I appreciate your time for any respones!</p>

<bitcoin-core><bitcoind><raspberry-pi><datadir>
How does bitcoind choose its data directory?
Steve Merriman
# How does bitcoind choose its data directory?

(Asked by: username_0 on 2020-02-20)

Sorry, noob question I am new to anything linux related. I managed to set up bitcoin core just fine on my raspberry pi 4 and I have an external HDD that I want to use as my data directory for the 250 GB or so of blocks (this is not my main storage that I boot from).

Problem is, I have absolutely no idea how the bitcoind program decides on its data directory. I have run 3 or 4 times and I have 3 or 4 different data directories, none of which are on the HDD. How do I tell it where to store the data? Also, where do I put the bitcoin.conf file because it can never seem to find it. I have most of the blockchain pre-installed on my HDD from my windows pc and so I would ideally use that same directory but if thats not possible thats fine, I at least want it on my HDD though. I have followed several guides and nothing has worked for me so far. I appreciate your time for any respones!

**Tags:** bitcoin-core, bitcoind, raspberry-pi, datadir


---

## 6 answers

### Answer by username_1 on 2020-02-20. Score: 4

Unless explicitly told otherwise, the `datadir` is always placed in `/home/$USER/.bitcoin`, there is no logic for automatically using any location other than this. The configuration file is always in the data directory as `bitcoin.conf`.


---

### Answer by username_2 on 2020-02-20. Score: 3

One of the ways of pointing to your data directory is making a change to your bitcoin.conf file (it's usually located in `~/.bitcoin/bitcoin.conf` path)
Add the line:

> datadir = /path\_to\_your\_data\_directory

If you're on raspberry Pi I highly suggest reading through the `Raspibolt` documentation, it's step by step installation guide, linking specific chapter related to your question below:
<https://stadicus.github.io/RaspiBolt/raspibolt_30_bitcoin.html#prepare-data-directory>

> **Comments:**
> **username_1**: 3 second delta has got to be some sort of new record.  

---

### Answer by username_3 on 2020-02-21. Score: 3

When you start bitcoind, you can specify a non-default data directory:

`$ bitcoind datadir=/your/custom/filepath`

This will override the option set in the `bitcoin.conf` file, if there is one set there.


---

### Answer by username_4 on 2020-02-22. Score: 1

here i have some example script for UTX token ( bitcoind and the friend )

[example script and manage blockchain](https://github.com/sicute/blockchain)

also in that script include block monitoring using bash and qt compare with public blockchain explore node


---

### Answer by username_5 on 2021-09-16. Score: 0

The SD card on a Raspberry Pi will not be large enough to accommodate the Bitcoin blockchain. However, by default the data directory will be /home/$USER/.bitcoin which is on the SD card. One way to change this to a data directory on an external hard disk drive would be to create a symbolic link to the new directory, as follows:

ln -s /mnt/ext/bitcoin /home/$USER/bitcoin/.bitcoin

Correct the above line to accommodate your pathways.

> **Comments:**
> **username_6**: Sandisk does make 1TB sd cards, even 1.5TB. That is more than enough to accomodate the Bitcoin blockchain.  

---

### Answer by username_7 on 2024-07-21. Score: 0

The default location for the data directory in Bitcoin Core depends on the host OS:

## On Linux

* if `$HOME` is set and non-empty: `$HOME/.bitcoin`
* otherwise `/.bitcoin`

## On MacOS:

* if `$HOME` is set and non-empty: `$HOME/Library/Application Support/Bitcoin`
* otherwise `/Library/Application Support/Bitcoin`

## On Windows:

* Until v28: `%APPDATA%\Bitcoin` which is by default `%USERPROFILE%\AppData\Roaming\Bitcoin` which is by default `C:\Users\<username>\AppData\Roaming\Bitcoin`
* Starting with v28: `%LOCALAPPDATA%\Bitcoin` (`%USERPROFILE%\AppData\Local\Bitcoin`, `C:\Users\<username>\AppData\Local\Bitcoin`)

[Source](https://github.com/bitcoin/bitcoin/blob/master/src/common/args.cpp#L697-L727)


---

