<p>If you would like to do this permanently create a <code>~/.bitcoin/bitcoin.conf</code> file and include:</p>

<p><code>datadir=/your/path</code></p>

CC BY-SA 4.0
2021-01-20T00:05:16.973Z
I just tried this and it doesn't work.  Can you please verify that the commands are still valid?
shoeless joe
CC BY-SA 4.0
2018-07-05T11:01:30.513Z
2018-07-05T11:01:30.513Z
tsusanka
<p>You probably forgot to move the bitcoin.conf file from your non-default data directory to the default location. (~/.bitcoin/bitcoin.conf)</p>
<p>Then when you rund bitcoind, it access the bitcoin.conf file in the default way, and that file tells bitcoind to put blocks where datadir= specifices.</p>

CC BY-SA 4.0
2023-08-06T23:12:37.643Z
that does work but then it creates another bitcoin.conf under the provided datadir path, and that's what bitcoin-qt also opens up... it is a bit confusing, should I set other conf settings in the .bitcoin/bitcoin.conf or new datadir's bitcoin.conf
WhoIsNinja
CC BY-SA 4.0
2021-11-23T12:38:36.270Z
2021-11-23T12:38:36.270Z
Arman The Parman
<p>you should use it like this bitcoin</p>

<pre><code>bitcoind -datadir=/your/external/path
</code></pre>

<p>Hope this helps!</p>

CC BY-SA 4.0
2021-02-02T18:38:40.703Z
Relative paths work too: `bitcoin-cli -datadir=. stop`
Gunar Gessner
CC BY-SA 3.0
2016-08-05T06:41:39.970Z
2016-08-05T06:41:39.970Z
Web Weave
<p>I am trying to change the data directory used by <code>bitcoind</code> and I am uder the impression that the command <code>-datadir</code> was removed as I can't find it with <code>bitcoin-cli help</code>, when I try to use it I get <code>Too few parameters</code> and <code>bitcoin-cli help datadir</code> says datadir doesn't exist. I need to specify a directory that is not on the root partition, how to do it ?</p>

<p>Also why bitcoin core is so user unfriendly, it's quite surprising I thought it was the main bitcoin program. It started downloading the blockchain on my root partition without me even being aware of it (just start bitcoind and it starts silently downloading).</p>

CC BY-SA 4.0
2019-11-14T02:01:37.527Z
Yeah, it would be better if it asked us where we wanted to store the large data files, when we install via the command line. It does not. Not even a warning or anything. Glad I found this post. :-)
Norman Bird
<bitcoind>
How to change the data directory with bitcoin-cli?
ChiseledAbs
# How to change the data directory with bitcoin-cli?

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

I am trying to change the data directory used by `bitcoind` and I am uder the impression that the command `-datadir` was removed as I can't find it with `bitcoin-cli help`, when I try to use it I get `Too few parameters` and `bitcoin-cli help datadir` says datadir doesn't exist. I need to specify a directory that is not on the root partition, how to do it ?

Also why bitcoin core is so user unfriendly, it's quite surprising I thought it was the main bitcoin program. It started downloading the blockchain on my root partition without me even being aware of it (just start bitcoind and it starts silently downloading).

**Tags:** bitcoind

> **Comments:**
> **username_1**: Yeah, it would be better if it asked us where we wanted to store the large data files, when we install via the command line. It does not. Not even a warning or anything. Glad I found this post. :-)  

---

## 3 answers

### Answer by username_6 on 2016-08-05. Score: 16 | Accepted answer

you should use it like this bitcoin
bitcoind -datadir=/your/external/path

Hope this helps!

> **Comments:**
> **username_7**: Relative paths work too: `bitcoin-cli -datadir=. stop`  

---

### Answer by username_2 on 2018-07-05. Score: 11

If you would like to do this permanently create a `~/.bitcoin/bitcoin.conf` file and include:

`datadir=/your/path`

> **Comments:**
> **username_3**: I just tried this and it doesn't work.  Can you please verify that the commands are still valid?  

---

### Answer by username_4 on 2021-11-23. Score: 1

You probably forgot to move the bitcoin.conf file from your non-default data directory to the default location. (~/.bitcoin/bitcoin.conf)

Then when you rund bitcoind, it access the bitcoin.conf file in the default way, and that file tells bitcoind to put blocks where datadir= specifices.

> **Comments:**
> **username_5**: that does work but then it creates another bitcoin.conf under the provided datadir path, and that's what bitcoin-qt also opens up... it is a bit confusing, should I set other conf settings in the .bitcoin/bitcoin.conf or new datadir's bitcoin.conf  

---

