rolffokkens / bdsync

a fast block device synchronizing tool
GNU General Public License v2.0
109 stars 26 forks source link

Concurrent diff generation and device patching #13

Closed shodanshok closed 8 years ago

shodanshok commented 8 years ago

Hi, I have a question about patching.

It is safe to concurrently scan for different blocks and patch the found ones? For example, take a look at the following command:

bdsync --hash=sha512 "ssh root@<remip> /usr/bin/bdsync --server" <locdev> <remdev> | ssh root@<remip> "/usr/bin/bdsync --patch"

As you can see, it pipes the diff file directly to remote patch command. I did some test with some small files/devs (1 or 2 GB) and it seems to work correctly. There are any contraindications on doing that (apart that if the transfer is interrupted, the remote device will be left in an inconsistent state)?

Thanks.

rolffokkens commented 8 years ago

Although not by design, this should be safe indeed. The blocks in the diff will not be visited again during th process of determining the diffs, so bdsync won't be confused by this. Blocks being in flux actually is not an issue in general: I used bdsync to synchronise running VM images to create a good approximation, followed by a bdsync action while the VM was down rendering a fast, small diff.

An small optimization of your command might be to run it from the other side using --remdata. In which case it can all be done by just one ssh connection.

shodanshok commented 8 years ago

Great. Thank you very much!