Author

Topic: bitcoin.conf and datadir in different directories (Read 255 times)

HCP
legendary
Activity: 2086
Merit: 4363
You setup symlinks in the "default" locations, that point to somewhere else (ie. your external devices)...

so, things like this:
Code:
ln -s /mnt/bitcoin/blocks /home/USERNAME/.bitcoin/blocks

That would create a link from the "blocks" folder on your external ssd (ie. /mnt/bitcoin/blocks) to your ~/.bitcoin folder. Essentially, it is doing at the OS level, what the -datadir, -blocksdir and -wallet commands do at the application level... but it gives you extra flexbility... as you can link any folder or file and not just the ones that those commands allow you to.

For instance, I do something similar on a Windows machine to hold the "chainstate" on a fast SSD, while the block data lives on a slower "HDD". It provides a good speed boost without requiring an (expensive) SSD to hold mostly static block data.
jr. member
Activity: 55
Merit: 67
How would you use this in relation to managing bitcoind?
jr. member
Activity: 55
Merit: 67
I'm not familiar with symbolic links yet.
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
I can confirm that it only impacts /blocks which is a pitty but ok I put the entire datadir on the ssd then

Well, if you want full control, I find the easiest to handle all the folders you want with symbolic links.
Actually I've never used those command line options because I've used symlinks.
HCP
legendary
Activity: 2086
Merit: 4363
Another question: I intend to install electrs on the Pi, should i create a different directory on the ssd for bitcoin datadir and one for electrs or just have them all together?
Personally, I would create a separate directory for the electrs data... it's just a cleaner setup and means that should you want to change to a different Electrum server solution later on, it won't mess up your Bitcoin datadir.
jr. member
Activity: 55
Merit: 67
I can confirm that it only impacts /blocks which is a pitty but ok I put the entire datadir on the ssd then
jr. member
Activity: 55
Merit: 67
I'll try it out next week and post it here! Another question: I intend to install electrs on the Pi, should i create a different directory on the ssd for bitcoin datadir and one for electrs or just have them all together?
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
I assume blocksdir affects the /blocks subdirectory, but do you know if it also affects the /chainstate and /indexes subdirectories?

From the way it's described, it'd say that it affects only the *.dat blocks and nothing else:

Code:
argsman.AddArg("-blocksdir=", "Specify directory to hold blocks subdirectory for *.dat files (default: )", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
jr. member
Activity: 55
Merit: 67
It should be noted... that the datadir option will, in addition to the block data, also move all your wallet and other associated application data onto the external drive. If you don't want your wallet file(s) stored on the external media, you might want to use the blocksdir option instead.

I wasn't aware if the blocksdir option... I have disablewallet=1 set in the conf file, I use this node purely to seed the network over tor and as a backend for wasabi / electrum but this option might still be interesting.
I assume blocksdir affects the /blocks subdirectory, but do you know if it also affects the /chainstate and /indexes subdirectories?
HCP
legendary
Activity: 2086
Merit: 4363
It should be noted... that the datadir option will, in addition to the block data, also move all your wallet and other associated application data onto the external drive. If you don't want your wallet file(s) stored on the external media, you might want to use the blocksdir option instead.
jr. member
Activity: 55
Merit: 67
I see. I just want to save the data to the ssd so I can attach it to any device at a later date. It's always a good idea to have an indexed version of the blockchain lying around :-)
bitcoin.conf can stay in ~/.bitcoin that way I don't have to remember running bitcoind with arguments
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Yes... that should indeed work as you intend. When the app starts up (assuming you don't use any commandline parameters), it will default to looking in the ~/.bitcoin folder for a bitcoin.conf... if you then specify in that bitcoin.conf that the "datadir" is somewhere else... then the application will use that other datadir for the location of the blocks and wallets etc.

Just for clarity, you can also have the bitcoin.conf in a non-standard location but the datadir in its default path. Just pass the -conf option to bitcoin core to specify the path of the config file, and the datadir location stays as ~/.bitcoin unless explicitly set in the config file.
HCP
legendary
Activity: 2086
Merit: 4363
Yes... that should indeed work as you intend. When the app starts up (assuming you don't use any commandline parameters), it will default to looking in the ~/.bitcoin folder for a bitcoin.conf... if you then specify in that bitcoin.conf that the "datadir" is somewhere else... then the application will use that other datadir for the location of the blocks and wallets etc.
jr. member
Activity: 55
Merit: 67
can I have the bitcoin.conf file in ~/.bitcoin and my datadir on an external ssd? Let's say I have a bitcoin.conf file in ~/.bitcoin which includes the argument 'datadir=/mnt/bitcoin' (this being where my ssd is mounted)

Can I then simply run bitocoind without arguments and will this work?
Jump to: