Polkadot node, How to make Backup file and use it.

melea crypto
Jun 14 ยท 4 min read

Hello, ๐Ÿ˜ƒ ๐ŸŒˆ

Polkadot and how to make one Backup file and use it.

Is a good practice make time to time your own backup from the blockchain, in case need up to another node in a quick way or just recover one node for a corrupted database. Better be prepared.

Learn more about Polkadot

https://polkadot.network/

Polkadot Explorer

https://telemetry.polkadot.io

Create one Backup file from your own database

First, have to stop Polkadot, because the backup is not going to work if Polkadot is running meanwhile the file is created.

Then open the directory where the folder db is and need to make the backup from the blockchain archived in that folder, this data is sync the last block from the moment before the stop the node.

cd .local/share/polkadot/chains/alexander

Compress the folder db

tar -zcvf db.tar.gz db

Now the Backup file is inside that folder, for can use another day

$ ~/.local/share/polkadot/chains/alexander$ lsdb 
db.tar.gz
keystore
network

How to use it the Backup file

First, have to stop Polkadot, the backup is not going to work if Polkadot is running meanwhile the backup is replaced.

Go to the directory where the folder is located and remove the actual database and decompress the file created previously, this is in case want to replace the actual data for the backup database and decompress the file db.tar.gz

cd .local/share/polkadot/chains/alexanderrm -rf dbtar -xzvf db.tar.gz

Start Polkadot with the new database.

Have to sync the last block when the backup was created.

Here is finish the backup practice.

Congrats for being worry about having a backup file and be ready in case you need one because I can tell you from my experience that day is for sure around the corner someday and you are going to be proud for being prepared for that situation.

This backup file can be used for up a new node and sync the last block from the database, this file no contains private data of your server or accounts, it only contains the data of the blockchain, for that, you can compile it and make it public, shared with other, etc.

Backup File for sync the last Polkadot testnet AkA ALexander

Alexander the testnet for Polkadot today has created more than 1.7M Blocks and is almost 11GB in one Backup file.

For Alexander Polkadot testnet the no official backup file from sync since block +1,700,000

๐ŸšจBe aware๐Ÿšจ

From here is at your own risk. You must be careful when downloading files from unknown sources. this is from my source. ;)

Stop Polkadot

Open the directory where Database folder is located

cd .local/share/polkadot/chains/alexanderRemove the actual DBrm -rf db

Download the backup file 12GB

https://ipfs.io/ipfs/QmVPbhVRVNmVj7Xk2NqL6fXAYHptwRnr1LyAwLADT998up

https://ipfs.io/ipfs/QmVPbhVRVNmVj7Xk2NqL6fXAYHptwRnr1LyAwLADT998up/db.tar.lz4

wget 'https://ipfs.io/ipfs/QmVPbhVRVNmVj7Xk2NqL6fXAYHptwRnr1LyAwLADT998up/db.tar.lz4'

Note: (The first time you want to download maybe it takes too long, must stop it and run the wget cmd again because #IPFS node is more Fast than GoogleCloud.

๐Ÿ‘€

12GB >23m

After download, the backup file is located in the same folder for decompressing and use it.

$ ~/.local/share/polkadot/chains/alexander$ lsdb 
db.tar.lz4
keystore
network

Decompress

lz4 -d db.tar.lz4 | tar -xvz

Copy to the right folder in case of decompressing in another folder by mistake.

cp -r db/* .local/share/polkadot/chains/alexander/db
#or
mv -r db $HOME/..local/share/polkadot/chains/alexander/db
#or
cp -r db $HOME/.local/share/polkadot/chains/alexander/

Remove useless files.

rm db.tar.gz

Start Polkadot with the new database.

polkadot --name '๐Ÿž your own name here ๐Ÿž'

After this, your Polkadot node last block has to be +1.7M

Backup lesson finish.

Now ๐Ÿ‘ฝ in case you are looking for be a Validator for Polkadot testnet or next mainnet here the last guide

https://wiki.polkadot.network/en/latest/polkadot/node/guides/how-to-validate/

Congratulations to be part of the next big thing AkA Polkadot, now if want to talk chat the official place is:

Riot

https://riot.im/app/#/room/#polkadot-watercooler:matrix.org

Telegram

https://t.me/PolkadotOfficial

Enjoy Polkadot.

GitHub

Cheers!

https://meleatrust.com/polkadot-melea-trust-validator-node/

Enjoy.