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