Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: crystal-love on January 08, 2021, 01:34:49 PM



Title: Change location of database (Linux ARM CLI)
Post by: crystal-love on January 08, 2021, 01:34:49 PM
Hello,
The installation of btc core, put's the program (as well as all 350GB) on the main disk, while doing installation:

sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.20.1/bin/*


But i believe, after installation there should be a configuration file somewhere, so i could point all database to the external drive, while keeping the program on the boot drive.

How do i do that?

Thank you


Title: Re: Change location of database (Linux ARM CLI)
Post by: HCP on January 09, 2021, 02:22:09 AM
When bitcoin-qt is first run, it should automatically create a .bitcoin directory in the users "home" directory aka ~/.bitcoin and it should prompt to ask where to set the datadir to. If you've already used that, you can try a couple of things to "move" the datadir:

In the .bitcoin directory, if you create a "bitcoin.conf" file... you can add the datadir option and set that to where you want the blocks stored...
Code: (bitcoin.conf)
datadir=full/path/to/your/bitcoin/datadir

Alternatively, simply start bitcoin-qt using the "-choosedatadir" option... it'll prompt you again to choose where you want the datadir to be set to.
Code:
bitcoin-qt -choosedatadir

https://talkimg.com/images/2023/11/15/z3ySG.png

NOTE: be wary of the "discard blocks after verification" (prune) option... that could cause problems later if you need to import private keys or rescan/reindex. I would suggest leaving it "UNCHECKED" if you have the storage space to store the full blockchain (350+gigs)


Also note that neither of these options will "move" the current contents of the datadir to the new location... so bitcoin core will start syncing from block 0 again.


Title: Re: Change location of database (Linux ARM CLI)
Post by: LoyceV on January 09, 2021, 11:22:46 AM
I just use a symlink (https://en.wikipedia.org/wiki/Symbolic_link) for my blocks-directory. This keeps chainstate on my SSD, and puts blocks on my (much larger) HDD.
Note: don't move the blocks directory while Bitcoin Core is running.


Title: Re: Change location of database (Linux ARM CLI)
Post by: NeuroticFish on January 09, 2021, 03:21:00 PM
I just use a symlink (https://en.wikipedia.org/wiki/Symbolic_link) for my blocks-directory. This keeps chainstate on my SSD, and puts blocks on my (much larger) HDD.
Note: don't move the blocks directory while Bitcoin Core is running.

I agree with LoyceV.
If you use the HDD for all the data, the sync will get much slower. Using symlink only for blocks will fix that.
I've done that myself although only temporarily, for tests.

If you go for external HDD, make sure your Bitcoin wallet is fully stopped when you add or remove the disk (this at least stands for Windoze, but nowadays this may be a problem for Linux too), in order to not risk invalid data.


Title: Re: Change location of database (Linux ARM CLI)
Post by: crystal-love on January 10, 2021, 05:56:24 PM
When bitcoin-qt is first run, it should automatically create a .bitcoin directory in the users "home" directory aka ~/.bitcoin and it should prompt to ask where to set the datadir to. If you've already used that, you can try a couple of things to "move" the datadir:

I'm using CLI version, so there was no prompt as it is in the GUI version. As well it did not asked me during the "installation" :)
So i will try "-choosedatadir" option" or bitcoin.conf (the one i was looking for), but looks like i have to create it by my self.



Title: Re: Change location of database (Linux ARM CLI)
Post by: crystal-love on January 10, 2021, 06:04:04 PM
I just use a symlink (https://en.wikipedia.org/wiki/Symbolic_link) for my blocks-directory. This keeps chainstate on my SSD, and puts blocks on my (much larger) HDD.
Note: don't move the blocks directory while Bitcoin Core is running.

This solution sounds even better :)
T.Y.