Move default .chia directory to an external SSD

I installed my chia plotter/farmer in a linux PC more than a year ago, using a small M.2 SSD drive. The plots were generated for farming on a pool, and are stored in external HDD disks. That plots have been working fine for all this time. The process at the time created the /home/user/.chia/mainnet directory, where the blockchain (db), wallet and other config files related are created. I have this .chia directory properly backuped (223GB)

After 1 year, that root disk is almost without free space to store the chia blockchain. Now I want to move that /home/user/.chia directory to a new 1TB SSD, and setup chia daemon to run using that external SSD mounted in /media/disk/, so a directory /media/disk/.chia/mainnet should be used instead.

Many daemons for diferent cryptos use a --datadir optarg directory for that (BTC, ETH, and others). I am searching something similar for chia. I am using 1.6.2 chia version, built from sources. But I don’t know how can I run the chia daemon to use a directory different to default /home/user/.chia.

I have tried using CHIA_ROOT=/media/disk/.chia/mainnet. This creates 2 directories:

/media/disk/.chia/mainnet/db
/media/disk/.chia/mainnet/wallet

but the /home/user/.chia/mainnet/config/ssl is still regenerated in my /home/user folder (created inside my root drive). So it is not using the /media/disk/.chia/mainnet/config/*. This for example has the problem that plots created for the pool are not found.

Please help with this would be appreciated. Thanks!

Just symlink it - “ln -s /media/disk/config ~/chia/mainnet/config”

1 Like

LVM home dir…I have it on all my servers. You can transparently grow the space at any time, and low level apps won’t notice.

Chia, Monero nodes eat now almost 300GB…Chia is growing too fast…I was cleaning disk last night…it jumped from about 40GB to over 100GB

Crypto devs should start to think about future of blockchain…Monero already started pruning…you don’t need whole blockchain…who the hell is interested in 10 years old Bitcoin transactions?

Running node for 20 years, and we will need 10TB just for blockchain…Monero offers at least offline download of blockchain instead of month of first sync.

Symlinking the config file worked as expected. Thanks for the tip!

However, during the process, something happened I don’t understand. Please, could you explain this?

I saw two blockchain files in my /media/disk/.chia/mainnet/db directory , named blockchain_v1_mainnet.sqlite and blockchain_v2_mainnet.sqlite. Each one consumed more than 107GB. Hoping to reduce the required space, I decided removing everything and started the whole process from scratch.

First, imported keys with “chia keys add”, using 24-words mnemonics, using the default .chia/mainnet/config directory created by chia daemon. The blockchain V2 started downloading. After downloading, my plots were not found/usable for farming.

At this point, I removed default config file and symlinked the config to my old configuration directory. Then restarted the chia server. At the moment, the blockchain V1 started downloading again.

I don’t undestand why V1 blockchain has to be downloaded again. But once the full V1 blockchain was properly downloaded/synchronized, the farming process started with all my plots. All of them are now properly found.

Just for reference, my plots were generated for the pool https://eu1.pool.space using the chia version 1.2, more than 18 months ago.

My questions:

  • Does this means that my plots need the blockchain V1 to work fine?
  • Can I use my plots with V2 in some way without having to download the V1 blockchain?
  • Should I replot all my HDD’s to avoid downloading V1 blockchain in the future?

Please help with this and thanks in advance!

Blockchain db v1 or v2 has no bearing on whether you setup sees those plots or not. That is controlled by configy.yaml and your .chia_keys file (basically what mnemonics your setup recognizes. So, when you start from scratch (i.e., you get a newly created config.yaml and .chia_keys file) your setup is fresh. The main thing is your original config.yaml. so, save that and use it all the time.

The v1 db is a pre v1.3.x or so, and you should not have it. You need to modify your config.yaml (something like db_path or so) and modify v1 to v2 there.

If you have a synced v2 db somewhere, you can always use that to continue after starting a new setup. That file is as good as gold.

In the wallet/db folder there are also 2 main wallet files. The old is rather big (GB), the new one is in the range of MB only and syncs very fast. So, you can for sure delete the v1 wallet files from ther (or rather move them for time being to another folder). Those old files will have a numeric signature (fingerprint for your keys). So, when you remove everything, you need to get the same fingerprints in new files, as that shows what mnemonics are recognized (to some extent).

If you have your old mnemonics, you don’t need to replot. Those two always match, regardless of what chia version you have or blockchain db version.

2 Likes

If you converted officially blockchain to compressed v2, you can erase v1. It suppose to change your config as well if I recall correctly.

I make regularly backups because it is hell to full sync. 110GB would take days

3 Likes

Thanks for your answers, I am working on this and will come back with my working solution at the end. Right now, this is not working as expected yet.

After chia init, I have created symlinks to all important directories, I mean:

/home/user/.chia/mainnet/db → /media/disk/.chia/mainnet/db
/home/user/.chia/mainnet/config → /media/disk/.chia/mainnet/config
/home/user/.chia/mainnet/cache → /media/disk/.chia/mainnet/cache
/home/user/.chia/mainnet/log → /media/disk/.chia/mainnet/log
/home/user/.chia/mainnet/run → /media/disk/.chia/mainnet/run
/home/user/.chia/mainnet/wallet → /media/disk/.chia/mainnet/wallet

In that way, it is supposed CLI and GUI should work as expected without using the CHIA_ROOT variable. Doing this, it is supposed all the relevant keys are in the proper location. So, after that, I started the chia server as usual with “chia start farmer”.

However, using the described setup, any of the plots is properly detected. GUI is reporting this:

Plots with missing keys: 268

And the “chia plots ckeck” command is reporting this for all plots:

WARNING: Plot /media/plots/plot-filename plot has a farmer public key that is not in the farmers pk list

If i check the “chia plotnft show”, it does not show the LaucherID nor the NFT contract I used to generate the plots, it simply shows this:

$ chia plotnft show
Wallet height: 3252747
Sync status: Synced

The “chia keys show” command does not show the proper public farmer key I used to generate the plots.

Where is the missing information stored? Does this setup should work. Or am I missing something else?

Thanks in advance!

I don’t think that anything related to your mnemonics is in that directory structure.

So, as long as you see log files in the new mainnet/logs, you see v2 blockchain db in mainnet/db it confirms that what you did (symlinking) is correct (I would just do one symlink linking the old mainnet to the new one, though).

To get those plots recognized, you need to import your original mnemonics to this new setup. Once you do that, you should see a v2 wallet with a fingerprint stamp similar to what you had in the old location in mainnet/wallet/db folder. As long as you don’t see that new wallet, your farmer has no clue what it should farm. If you see a wallet with an unrecognized fingerprint, it would imply that you have new mnemonic that has nothing to do with the old plots. You can safely remove all files from that wallet folder, as that db doesn’t take much time to be regenerated (actually, dosn’t require the bc db to be there, as wallet will sync with remote nodes if the local db is not there).

Looks like you can issue “chia keys add” to import your original keys - Moving plots · Chia-Network/chia-blockchain Wiki · GitHub

1 Like

Hello and thank you in advance for all your support. I just wanted to share my final solution with all of you:

The reported warning

WARNING: Plot /media/plots/plot-filename plot has a farmer public key that is not in the farmers pk list

was solved as you reported, importing the private key using the 24-words mnemonic with the command:

$ chia keys add

After that, all the plots could be checked properly with the command:

$ chia plots check

I was not aware of how important was the “config” directory. Now I have a backup of the whole contents, as it seems the NFT contract used to generate the plots is there. If you loose this directory contents, you should regenate all HDD plots again. That should be a terrible headache righ now.

Symlinking all the directories as suggested was a perfect solution to work both with CLI and GUI. So, at the end, using CHIA_ROOT environ variable was not used at all. Symlinks are working great.

Finally, the problem of having both V1 and V2 blockchains in the db/ directory was fixed editing this configuration file:

vim /home/user/.chia/mainnet/config/config.yaml

and setting “database_path” key with this value:

database_path: db/blockchain_v2_mainnet.sqlite

After restarting chia daemon, it was safe to remove blockchain_v1 version (more than 100GB of free space).

Thank you very much to all of you!! :slight_smile: