Cosmos SDK, how to make one Backup

melea crypto
Jun 15 · 3 min read

Cosmos adoption is growing and meanwhile more nodes run every day the Cosmos software and at the same time the blockchain is growing and up a node and sync from scratch can take some time, the best practice, if your plan is run a node in the long term, is make one backup file from the database folder that contains the blockchain data.

This data is needed for run a node and sync the last block after the backup file was created, this backup file can be used for the node where was made or for up a new node, can share the file because no contain any personal or private data, only the blockchain record.

The steps are very simple and are described in this post

First need stop the cosmos software AkA gaiad, after stop and be sure the Cosmos program is stop, in that moment can start the backup process.

After stop open the directory where is located the folder that contain the data for make the backup file.

cd .gaiad

In that directory is the folder data, compress that folder

tar -czvf data.tar.gz data

Now have a Backup file and the original folder

data.tar.gz

can start the cosmos software again.

gaiad start

Using the backup file

If / when need use the backup file, stop Cosmos software gaiad and go to the directory

cd .gaiad

remove the actual database for decompress the backup file after that

rm -rf data

Ok, after decompress and start Cosmos again, have to start to sync the last block when was made the backup file.

In case you are looking for, here is one backup for the actual mainnet for the Cosmos Hub-2, the plan is upload the link here meanwhile the file is update time to time, this is the last:

https://ipfs.io/ipfs/QmfZx7QPAxL2q9WyaKgZshVjLRUe5XwFFNrog9NpoVYgsc

wget 'https://ipfs.io/ipfs/QmdQFjRboJAXRNLMZtUfP2gLBSNHVArDYeVmaEHR1Vf4Nw' -O data.tar.gz

or

wget 'https://gateway.ipfs.io/ipfs/QmdQFjRboJAXRNLMZtUfP2gLBSNHVArDYeVmaEHR1Vf4Nw' -O data.tar.gz

#for applying the backup after download

#stop gaiad

Done!

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.

Please remember support my validator for the Cosmos hub meleatrust

https://meleatrust.com/cosmos-melea-trust-validator/

Thanks for the support and for being part of this great Cosmos community

Cheers!

Looking for run a node Doker guide

https://medium.com/@meleacrypto/cosmos-sdk-docker-recover-add-an-account-from-the-fundraiser-and-delegate-stake-atom-to-9422814576c8?source=friends_link&sk=aeee5a23de63bbed90190866c8a8918f