How to get rsync to synchronize only new blocks for blockchain

Every time I run rsync to backup a blockchain, it starts from the beginning and tries to sync the whole thing, every time, even though there may only be a few blocks worth of data that is new. The rsync man page says, "It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination," but I cannot figure out how to get it to only update the new info that has been added to the blockchain. As the chain is very large, it is ridiculous to keep copying the whole thing every day. Can rsync backup only new data, and if so, how can I tell it to do so?

This what I am using:

> rsync -avz --exclude-from=/exclude/file -e ssh /from/file :/backup/file
4

2 Answers

According to this article, a combination of the following properties should work for you:

--partial --inplace --append

In your case that would be:

rsync -avz --partial --inplace --append --exclude-from=/exclude/file -e ssh /from/file :/backup/file

It also makes sense to me that a blockchain would only need "appended" data, i.e. added blocks.

In addition, --progress can be added as well.

I believe you need the --inplace option.

Normally, rsync creates a new file for every transfer and removes the old one when the transfer was successful, so any interrupt will still keep one version of the file intact. With --inplace it writes the existing file directly, so an interrupt may leave an inconsistent file behind; that's why it's not the default.

9

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like