<p>Make sure to stop bitcoind with <code>bitcoin-cli stop</code>, then move your data directory to a new folder and add the following line to your <code>bitcoin.conf</code>:</p>

<pre><code>datadir=path/to/new/directory
</code></pre>

<p>This file should be somewhere in <code>C:\Users\username\AppData\Roaming\Bitcoin\bitcoin.conf</code> in Windows and <code>~/.bitcoin/bitcoin.conf</code> in Linux.</p>

<p>As the user AntMor replied, you can also pass this configuration every time you run bitcoind.</p>

CC BY-SA 4.0
2019-12-18T19:04:12.370Z
Thank you Pedro! I will try it.. Just when I write datadir=path/to/new/directory instead of directory I shoud give the path to my directory, right? And if I do this whenever I run bitcoind it will be run in the directory I gave right? Thanks a lot
saadia
CC BY-SA 4.0
2019-12-18T19:07:57.693Z
yes, make sure the directory exists and you will notice new files being created as soon as bitcoind starts running. When you run `df -h` on the command line what do you get?
Pedro
CC BY-SA 4.0
2019-12-19T07:22:23.913Z
when İ run df -h  I get this                                          Filesystem      Size  Used Avail Use% Mounted on
rootfs          223G  216G  7.2G  97% /
none            223G  216G  7.2G  97% /dev
none            223G  216G  7.2G  97% /run
none            223G  216G  7.2G  97% /run/lock
none            223G  216G  7.2G  97% /run/shm
none            223G  216G  7.2G  97% /run/user
C:              223G  216G  7.2G  97% /mnt/c
D:              932G  113G  820G  13% /mnt/d
saadia
CC BY-SA 4.0
2019-12-19T07:27:57.593Z
so for d partition I can use this path /mnt/d ?
saadia
CC BY-SA 4.0
2019-12-19T12:34:38.803Z
yes, try to move the data folder to somewhere in /mnt/d , run bitcoind as root (sudo bitcoind ...) just in case to make sure you have permissions.
Pedro
CC BY-SA 4.0
2019-12-19T13:23:43.867Z
It worked thank you pedro .. but when ı run bitcoin-cli -testnet getblockchaininfo in another terminal ı got this error [ error: incorrect rpcuser or rpcpassword (authorization failed)]
saadia
CC BY-SA 4.0
2019-12-19T13:27:23.273Z
to enable testnet you need to add `testnet=1` to `bitcoin.conf` and restart bitcoind. It uses mainnet by default. does it work without the `-testnet` option? Also you can remove any `rpcuser` and `rpcpassword` from your configuration if you plan to use it locally as it will authenticate with the cookie
Pedro
CC BY-SA 4.0
2019-12-19T13:31:00.783Z
Also remove `rpcbind` and `rpcallowip` if you have any.
Pedro
CC BY-SA 4.0
2019-12-19T13:36:34.337Z
İ will try it..without -testnet it gave me this erroer 8333 failed after select(): Connection refused (111). And bitcoin-cli was working when i don't specify the directory
saadia
CC BY-SA 4.0
2019-12-19T13:42:27.623Z
when i removed what you told me ı got this error:  error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set.  See -rpcpassword and -stdinrpcpass.  Configuration file: (/home/saadia/.bitcoin/bitcoin.conf)
saadia
CC BY-SA 4.0
2019-12-19T13:45:38.380Z
I am guessing it's an issue with permissions, do you see anything being filed in your /mnt/d/... folder? try running `sudo bitcoin-cli ...` and what does your `/mnt/d/.../debug.log` say?
Pedro
CC BY-SA 4.0
2019-12-19T13:48:59.880Z
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/102377/discussion-between-pedro-and-saadia).
Pedro
CC BY-SA 4.0
2019-12-18T18:49:15.450Z
2019-12-18T18:58:24.917Z
2019-12-18T18:58:24.917Z
Pedro
<p>You need to run <code>bitcoind</code> with a different <code>-datadir</code> parameter. This is, all the blockchain data is under a folder (binaries and database files from LevelDB). What you need to do is something like the following:</p>

<pre><code>/path-to-bitcoin/bitcoind -datadir=/path-to-directory/
</code></pre>

CC BY-SA 4.0
2019-12-18T19:01:48.437Z
Thank you for your answer! How can I find the path of D partition because ubuntu that I have used allows me  to use just the terminal so I can just type commands. How D partition is known inside ubuntu?
saadia
CC BY-SA 4.0
2019-12-18T18:49:48.197Z
2019-12-18T18:49:48.197Z
AntMor
<p>I installed bitcoin core in windows 10 using ( Windows Subsystem for Linux ) . I installed ubuntu from the store and I used it to Install bitcoin core. The thing is everything was installed in the main hard disk C and it doesn't have enough space to download blocks. Is there a way to copy it to another partition (D partition because it has enough space) ? or while running bitcoind is there any way to run it with a specified path?</p>

<p>Ps: I hope the question is clear</p>

<p>Thank you</p>

CC BY-SA 4.0
2019-12-18T19:11:05.370Z
Does this answer your question? [How to change the data directory with bitcoin-cli?](https://bitcoin.stackexchange.com/questions/47892/how-to-change-the-data-directory-with-bitcoin-cli)
Pedro
<bitcoin-core><bitcoind>
Running bitcoind in a different directory
saadia
# Running bitcoind in a different directory

(Asked by: username_0 on 2019-12-18)

I installed bitcoin core in windows 10 using ( Windows Subsystem for Linux ) . I installed ubuntu from the store and I used it to Install bitcoin core. The thing is everything was installed in the main hard disk C and it doesn't have enough space to download blocks. Is there a way to copy it to another partition (D partition because it has enough space) ? or while running bitcoind is there any way to run it with a specified path?

Ps: I hope the question is clear

Thank you

**Tags:** bitcoin-core, bitcoind

> **Comments:**
> **username_1**: Does this answer your question? [How to change the data directory with bitcoin-cli?](https://bitcoin.stackexchange.com/questions/47892/how-to-change-the-data-directory-with-bitcoin-cli)  

---

## 2 answers

### Answer by username_1 on 2019-12-18. Score: 2 | Accepted answer

Make sure to stop bitcoind with `bitcoin-cli stop`, then move your data directory to a new folder and add the following line to your `bitcoin.conf`:

```
datadir=path/to/new/directory

```

This file should be somewhere in `C:\Users\username\AppData\Roaming\Bitcoin\bitcoin.conf` in Windows and `~/.bitcoin/bitcoin.conf` in Linux.

As the user username_2 replied, you can also pass this configuration every time you run bitcoind.

> **Comments:**
> **username_0**: Thank you username_1! I will try it.. Just when I write datadir=path/to/new/directory instead of directory I shoud give the path to my directory, right? And if I do this whenever I run bitcoind it will be run in the directory I gave right? Thanks a lot  
> **username_1**: yes, make sure the directory exists and you will notice new files being created as soon as bitcoind starts running. When you run `df -h` on the command line what do you get?  
> **username_0**: when İ run df -h  I get this                                          Filesystem      Size  Used Avail Use% Mounted on rootfs          223G  216G  7.2G  97% / none            223G  216G  7.2G  97% /dev none            223G  216G  7.2G  97% /run none            223G  216G  7.2G  97% /run/lock none            223G  216G  7.2G  97% /run/shm none            223G  216G  7.2G  97% /run/user C:              223G  216G  7.2G  97% /mnt/c D:              932G  113G  820G  13% /mnt/d  
> **username_0**: so for d partition I can use this path /mnt/d ?  
> **username_1**: yes, try to move the data folder to somewhere in /mnt/d , run bitcoind as root (sudo bitcoind ...) just in case to make sure you have permissions.  
> **username_0**: It worked thank you username_1 .. but when ı run bitcoin-cli -testnet getblockchaininfo in another terminal ı got this error [ error: incorrect rpcuser or rpcpassword (authorization failed)]  
> **username_1**: to enable testnet you need to add `testnet=1` to `bitcoin.conf` and restart bitcoind. It uses mainnet by default. does it work without the `-testnet` option? Also you can remove any `rpcuser` and `rpcpassword` from your configuration if you plan to use it locally as it will authenticate with the cookie  
> **username_1**: Also remove `rpcbind` and `rpcallowip` if you have any.  
> **username_0**: İ will try it..without -testnet it gave me this erroer 8333 failed after select(): Connection refused (111). And bitcoin-cli was working when i don't specify the directory  
> **username_0**: when i removed what you told me ı got this error:  error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set.  See -rpcpassword and -stdinrpcpass.  Configuration file: (/home/username_0/.bitcoin/bitcoin.conf)  
> **username_1**: I am guessing it's an issue with permissions, do you see anything being filed in your /mnt/d/... folder? try running `sudo bitcoin-cli ...` and what does your `/mnt/d/.../debug.log` say?  
> **username_1**: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/102377/discussion-between-username_1-and-username_0).  

---

### Answer by username_2 on 2019-12-18. Score: 0

You need to run `bitcoind` with a different `-datadir` parameter. This is, all the blockchain data is under a folder (binaries and database files from LevelDB). What you need to do is something like the following:

```
/path-to-bitcoin/bitcoind -datadir=/path-to-directory/

```

> **Comments:**
> **username_0**: Thank you for your answer! How can I find the path of D partition because ubuntu that I have used allows me  to use just the terminal so I can just type commands. How D partition is known inside ubuntu?  

---

