Lite-Node Backup and Restore

For backup and restore of the lite-node installation the snap integration the is recommended way to go. https://snapcraft.io/blog/how-to-create-snapshots-of-your-snaps

Backup

The typical procedure looks like this:

# Step 1: flush any caches so they are not part of the backup:
> diode-node.flush

# Step 2: stop the node so the database is closed
> snap stop diode-node
...
# Step 3: the actual backup
> snap save diode-node
Set  Snap        Age    Version   Rev  Size    Notes
5    diode-node  764ms  v1.5.17   190  10.2MB  -

This last “Set” number is important as it will be prefix of a zip file created by snap. This backup zip file resides in /var/lib/snapd/snapshots on ubuntu systems. Top copy this to another machine.

Transfer

Let’s assume we have a new machine called newmachine.dev and it is reachable from the old machine. Then we can copy the file using scp from the old machine to the new one like this:

scp /var/lib/snapd/snapshots/5_diode-node*.zip newmachine.dev: 

Restore

Finally to restore from the backup we install diode-node and use the backup zip file:

# Step 1: install diode-node
snap install diode-node

# Step 2: put the backup file into the snapshots directory 
sudo cp 5_diode-node*.zip /var/lib/snapd/snapshots/

# Step 3: stop before applying the restore so no partial files are written 
# (is is typically auto-started during installation)
snap stop diode-node

# Step 4: actual data restore
snap restore 5 diode-node

# Step 5: restart the service
snap start diode-node
1 Like