]> Sergey Matveev's repositories - syncer.git/blob - README.md
Pretty output printer
[syncer.git] / README.md
1 # syncer
2
3 Fast stateful file/disk data syncer.
4
5 ## Description
6
7 The main purpose of this utility is fast data synchronization between
8 two hard drives: one is fast (SSD, SATA HDD), another is connected
9 through slow USB interface. Target is to lower data amounts needed to
10 be transferred.
11
12 This utility is stateful: it keeps precomputed data hashes in separate
13 statefile and uses it to determine if we need to update block of data.
14
15     # sync from very fast SSD to slow USB connected HDD
16     % ./syncer -src /dev/ada0 -dst /dev/da0 -state state.bin
17     [%%%%%%]
18     # all blocks were transferred to da0
19
20 Now we have statefile containing cryptographic hashes of the blocks from
21 source and copy of all read data in destination. Now if we run it again:
22
23     % ./syncer -src /dev/ada0 -dst /dev/da0 -state state.bin
24     [....%.]
25     # only one block was transferred to da0
26
27 Only one modified block was transferred during this session. We read all
28 data from source again, compute hashes and understand what was updated
29 since the last run. Statefile is updated at the end.
30
31 Utility parallelize hash computations among all found CPUs. It updates
32 statefile atomically (saves data in temporary file and then renames it).
33 You can configure the blocksize: shorter transfers but bigger statefile
34 (it is kept in memory), or larger transfer and smaller statefile. All
35 writes are sequential.
36
37 syncer is free software: see the file COPYING for copying conditions.
38
39 ## Installation
40
41     % go get github.com/dchest/blake2b
42     % go build
43     # syncer executable file should be in current directory
44
45 ## Statefile Format
46
47     SRC_SIZE || BLK_SIZE || HASH0 || HASH1 || ...
48
49 `SRC_SIZE` contains size of the source, when it was initially read.
50 `BLK_SIZE` is the blocksize used. Both are 64-bit big-endian unsigned
51 integers. If either size or blocksize differs, then syncer will deny
52 using that statefile as a precaution. `HASHx` is BLAKE2b-512 hash
53 output, 64 bytes.