Skip to content

Instantly share code, notes, and snippets.

@michaelsproul
Last active July 3, 2017 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelsproul/ffd930288808a70fd3d97f72b82ae971 to your computer and use it in GitHub Desktop.
Save michaelsproul/ffd930288808a70fd3d97f72b82ae971 to your computer and use it in GitHub Desktop.
Seamlessly move Bitcoin data directory

I just moved my bitcoin data out of ~/.bitcoin by using the -datadir flag to bitcoind.

$ bitcoind -daemon -datadir=/external-drive/btc

However, I found that I now needed to pass -datadir=/external-drive/btc to bitcoin-cli in order for the passwordless authentication to succeed.

Rather than passing the flag every time, you can also change where bitcoind will stash the authentication cookie (which is what enables passwordless auth). Moving it back to ~/.bitcoin/.cookie does the trick, like so:

$ bitcoind -daemon -datadir=/external-drive/btc -rpccookiefile=$HOME/.bitcoin/.cookie

Now I can just use bitcoin-cli (with no extra args) to my heart's content :D

File under: note to self, might be useful for someone somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment