User Tools

Site Tools


guides:farming:upgradedb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
guides:farming:upgradedb [2022/05/17 09:57] – created vleesbanaanguides:farming:upgradedb [2022/06/21 08:09] (current) vleesbanaan
Line 1: Line 1:
 ===== How to Upgrade the Chia db ===== ===== How to Upgrade the Chia db =====
 +
 +Upgrading the Chia db from v1 to v2 CAN be a very simple process. 
 +However, the reason you are reading this guide is most probably because you want to learn how to upgrade AFTER your drive is full and you don't want to sync from scratch. 
 +
 +We will go through three different ways:
 +  - Upgrading the easy way
 +  - Download v2 from a trusted source and replace v1 
 +  - Using an external SSD
 +  - Using the SpaceFarmer Community Node
 +
 +
 +==== 1. Updating the easy way ====
 +
 +  * in CLI change directory to chia ''cd c:\Users\%USERNAME%\AppData\Local\chia-blockchain\a*\resources\app.asar.unpacked\daemon\''
 +  * run ''chia db upgrade'' in CLI. 
 +  * Update your config.yaml under the ''full_node:'' section from ''database_path: db/blockchain_v1_CHALLENGE.sqlite'' to ''database_path: db/blockchain_v2_CHALLENGE.sqlite''
 +
 +
 +There are two prerequisites for upgrading the Chia db the easy way. 
 +  * enough space on the target directory
 +  * enough space on your temporary directory (often overlooked)
 +
 +For further reference, see https://github.com/Chia-Network/chia-blockchain/wiki/FAQ#what-is-the-new-database. 
 +
 +==== 2. Download and replace ====
 +The advantage of this method is that it is easy and has minimal downtime. The trick is to download the db right after the snapshot, so your node needs to do minimal syncing to catch up with the latest blockheight. The downside is that you need to trust the source from which you download the snapshot. 
 +
 +  - Stop all chia processes
 +  - go to ''C:\Users\%USERNAME%\.chia\mainnet\db'' and delete ''blockchain_v1_mainnet.sqlite''
 +  - download the v2 db from a source you trust and place it in the folder. Spacefarmers offers a daily snapshot [[guides/farming/downloaddb|here]]
 +  - in your your config.yaml, replace under the ''full_node:'' section from ''database_path: db/blockchain_v1_CHALLENGE.sqlite'' to ''database_path: db/blockchain_v2_CHALLENGE.sqlite''
 +
 +==== 3. Using an external SSD ====
 +
 +  * stop all chia processes ''chia stop all''
 +  * [[guides/farming/movedb|Move the chia db v1 to another folder]]
 +  * Make sure your TMP folder has enough space available (size of v1+v2). If not, see the fix under "Error when TMP folder full".
 +  * in CLI change directory to chia ''cd c:\Users\%USERNAME%\AppData\Local\chia-blockchain\a*\resources\app.asar.unpacked\daemon\''
 +  * ''chia db upgrade''
 +  * in your your config.yaml, replace under the ''full_node:'' section from ''database_path: db/blockchain_v1_CHALLENGE.sqlite'' to ''database_path: db/blockchain_v2_CHALLENGE.sqlite''
 +  * when done, ''chia start farmer -r'' and wait for it to sync
 +
 +=== 3.1 Error when TMP folder full ===
 +The method above doesn't work if your TMP folder (which is  ''C:\Users\%USERPROFILE%\Appdata\Local\Temp'' by default on Windows) is on the full drive. 
 +
 +You will attempt to do so, you get a pop-up with the following window somewhere in the process: 
 +<code>Chia.exe - Delayed Write Failed
 +Windows was unable to save all the data for the file \chiaDB\blockchain_v2_mainnet.sqlite: the data has been lost. 
 +This error may be caused if the device has been removed or the media is write-protected.</code>
 +
 +And in the CLI you will find the following:
 +<code>Conversion failed with error: disk I/O error. 
 +The target v2 database is left in place (possibily in an incomplete state) D:\<PathforDB>\blockchain_v2_mainnet.sqlite
 +
 +If your failure was caused by a full disk, ensure the volumes of your temporary- and target directory have sufficient free space. 
 +Your temporary directory may be ''C:\Users\%USERNAME%\Appdata\Local\Temp''
 +you can specify the "TMP" environment variable to control the temporary directory to be used. </code>
 +
 +The work-around for this is to change your temporary folder to the new SSD (temporarily), by configuring your accounts Environmental Variables.
 +
 +  * Go to Settings and search: edit environmental variables for your account
 +  * Edit the TMP field and change from ''C:\Users\%USERPROFILE%\Appdata\Local\Temp''  to the new drive, e.g. ''D:\chiaDB\''
 +  * In case you already used ''chia db upgrade'', remove the blockchain_v2_mainnet.sqlite that was created in your target folder.
 +  * ''chia db upgrade''
 +
 +after you are done, don't forget to set back your temporary folder back to your original folder!
 +
 +==== 4. SpaceFarmer Community Node ====
 +It is also possible to farm without running a full node locally. Using the hooks that already exist in Chia 1.3+, we created the [[poolinfo/join/communitynode|SpaceFarmer Community Node]] to allow farmers that cannot run their own node to continue farming. 
guides/farming/upgradedb.1652781439.txt.gz · Last modified: 2022/05/17 09:57 by vleesbanaan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki