Debian Codegraph @

README.md

raw
1 # desync
2
3 Content-addressed binary distribution, reimplemented in Go.
4
5 [![Go Reference](https://pkg.go.dev/badge/github.com/folbricht/desync.svg)](https://pkg.go.dev/github.com/folbricht/desync)
6 [![CI](https://github.com/folbricht/desync/actions/workflows/validate.yaml/badge.svg)](https://github.com/folbricht/desync/actions/workflows/validate.yaml)
7 [![License](https://img.shields.io/github/license/folbricht/desync)](LICENSE)
8
9 desync is a Go library and CLI tool that re-implements [casync](https://github.com/systemd/casync) features for content-addressed binary distribution. It chunks large files using a rolling hash, deduplicates and compresses chunks with [zstd](https://github.com/facebook/zstd), and distributes them via multiple store backends. It maintains compatibility with casync's data structures, protocols and types (chunk stores, index files, archives) to function as a drop-in replacement.
10
11 ## Key Features
12
13 - **Parallel chunking** — identical output to casync, up to 10x faster
14 - **Multiple store backends** — local, HTTP(S), S3/GCS, SFTP, SSH
15 - **Store chaining and caching** — combine stores with failover groups
16 - **Seeds and reflinks** — clone blocks from existing files on Btrfs/XFS
17 - **Built-in servers** — HTTP(S) chunk server and index server with proxy support
18 - **FUSE mounting** — mount blob indexes as files
19 - **Tar interoperability** — create/extract catar from standard tar streams
20 - **Chunk encryption** — optional store encryption with XChaCha20-Poly1305 or AES-256-GCM
21 - **Cross-platform** — Linux, macOS, Windows (subset), BSD
22
23 ## Table of Contents
24
25 - [Installation](#installation)
26 - [Quick Start](#quick-start)
27 - [Concepts](#concepts)
28 - [Terminology](#terminology)
29 - [Parallel Chunking](#parallel-chunking)
30 - [Seeds and Reflinks](#seeds-and-reflinks)
31 - [Tar Interoperability](#tar-interoperability)
32 - [Store Backends](#store-backends)
33 - [Capabilities](#capabilities)
34 - [Store Architecture](#store-architecture)
35 - [Chaining and Caching](#chaining-and-caching)
36 - [Failover Groups](#failover-groups)
37 - [S3 Store URLs](#s3-store-urls)
38 - [Compressed vs Uncompressed](#compressed-vs-uncompressed)
39 - [Chunk Encryption](#chunk-encryption)
40 - [Remote Indexes](#remote-indexes)
41 - [CLI Reference](#cli-reference)
42 - [Commands](#commands)
43 - [Common Options](#common-options)
44 - [Environment Variables](#environment-variables)
45 - [Configuration](#configuration)
46 - [Dynamic Store Configuration](#dynamic-store-configuration)
47 - [Configuration Reference](#configuration-reference)
48 - [Example Config](#example-config)
49 - [Examples](#examples)
50 - [Extraction](#extraction)
51 - [Chunking](#chunking)
52 - [Cache and Store Management](#cache-and-store-management)
53 - [Archives](#archives)
54 - [Server Examples](#server-examples)
55 - [Update Size Estimation](#update-size-estimation)
56 - [Platform Support](#platform-support)
57 - [Design Philosophy](#design-philosophy)
58 - [Links](#links)
59
60 ## Installation
61
62 Install the latest release into `$HOME/go/bin`:
63
64 ```text
65 go install -v github.com/folbricht/desync/cmd/desync@latest
66 ```
67
68 Or build from source:
69
70 ```text
71 git clone https://github.com/folbricht/desync.git
72 cd desync/cmd/desync && go install
73 ```
74
75 ## Quick Start
76
77 **Chunk a file** — split a blob into chunks and create an index:
78
79 ```text
80 desync make -s /tmp/store index.caibx /path/to/largefile
81 ```
82
83 **Extract a file** — reassemble a blob from its index and chunk store:
84
85 ```text
86 desync extract -s /tmp/store index.caibx /path/to/largefile
87 ```
88
89 **Extract with remote store and local cache** — fetch chunks over HTTP, cache locally:
90
91 ```text
92 desync extract -s http://server/store -c /tmp/cache index.caibx /path/to/largefile
93 ```
94
95 ## Concepts
96
97 ### Terminology
98
99 | Term | Description |
100 | --- | --- |
101 | **chunk** | A section of data from a file, typically 16KB-256KB. Identified by the SHA512-256 checksum of its uncompressed data. Stored compressed with zstd (`.cacnk` extension). Boundaries are determined by a [rolling hash algorithm](http://0pointer.net/blog/casync-a-tool-for-distributing-file-system-images.html). |
102 | **chunk store** | Location (local or remote) that stores chunks. Can be a local directory, or accessed via HTTP, S3, GCS, SFTP, or SSH. |
103 | **index** | Data structure mapping chunk IDs to byte offsets within a file. A small representation of a much larger file. Produced by `make`. Given an index and a chunk store, the original file can be reassembled or FUSE-mounted. |
104 | **index store** | Location for index files. Can be local, SFTP, S3, GCS, or HTTP. |
105 | **catar** | Archive of a directory tree, similar to tar (`.catar` extension). |
106 | **caidx** | Index file of a chunked catar archive. |
107 | **caibx** | Index of a chunked regular blob. |
108
109 ### Parallel Chunking
110
111 One of the significant differences to casync is that desync attempts to make chunking faster by utilizing more CPU resources, chunking data in parallel. Depending on the chosen degree of concurrency, the file is split into N equal parts and each part is chunked independently. While the chunking of each part is ongoing, part1 is trying to align with part2, and part3 is trying to align with part4 and so on. Alignment is achieved once a common split point is found in the overlapping area. If a common split point is found, the process chunking the previous part stops, e.g. part1 chunker stops, part2 chunker keeps going until it aligns with part3 and so on until all split points have been found. Once all split points have been determined, the file is opened again (N times) to read, compress and store the chunks.
112
113 While in most cases this process achieves significantly reduced chunking times at the cost of CPU, there are edge cases where chunking is only about as fast as upstream casync (with more CPU usage). This is the case if no split points can be found in the data between min and max chunk size as is the case if most or all of the file consists of 0-bytes. In this situation, the concurrent chunking processes for each part will not align with each other and a lot of effort is wasted.
114
115 | Command | Mostly/All 0-bytes | Typical data |
116 | --- | --- | --- |
117 | `make` | Slow (worst-case) — likely comparable to casync | Fast — parallel chunking |
118 | `extract` | Extremely fast — effectively the speed of a `truncate()` syscall | Fast — done in parallel, usually limited by I/O |
119
120 While casync supports very small min chunk sizes, optimizations in desync require min chunk sizes larger than the window size of the rolling hash used (currently 48 bytes). The tool's default chunk sizes match the defaults used in casync: min 16KB, avg 64KB, max 256KB.
121
122 ### Seeds and Reflinks
123
124 Copy-on-write filesystems such as Btrfs and XFS support cloning of blocks between files in order to save disk space as well as improve extraction performance. To utilize this feature, desync uses several seeds to clone sections of files rather than reading the data from chunk stores and copying it in place:
125
126 - **Null Seed** — a built-in seed for chunks of max size containing only 0 bytes. This can significantly reduce disk usage of files with large 0-byte ranges, such as VM images, effectively turning an eager-zeroed VM disk into a sparse disk.
127 - **Self Seed** — as chunks are written to the destination file, the file itself becomes a seed. If a chunk or series of chunks appears again later in the file, it is cloned from the position written previously, saving storage for files with repetitive sections.
128 - **File Seeds** — seed files and their indexes can be provided when extracting. For example, `image-v1.vmdk` and `image-v1.vmdk.caibx` can be used as seed for extracting `image-v2.vmdk`. The additional disk space required will be only the delta between the two versions.
129
130 ```mermaid
131 graph LR
132 subgraph "External Seeds"
133 S1["Seed 1<br/>(file + index)"]
134 S2["Seed 2<br/>(file + index)"]
135 end
136
137 subgraph "Built-in Seeds"
138 NS["Null Seed<br/>(zero chunks)"]
139 SS["Self Seed<br/>(growing file)"]
140 end
141
142 CS["Chunk Store<br/>(fallback)"]
143
144 Result["Result File"]
145
146 S1 -- "clone/copy<br/>matching chunks" --> Result
147 S2 -- "clone/copy<br/>matching chunks" --> Result
148 NS -- "clone/copy<br/>zero regions" --> Result
149 SS -- "clone/copy<br/>repeated sections" --> Result
150 CS -. "fetch<br/>remaining chunks" .-> Result
151
152 style S1 fill:#4a90d9,stroke:#2a6cb0,color:#fff
153 style S2 fill:#4a90d9,stroke:#2a6cb0,color:#fff
154 style NS fill:#6ab04c,stroke:#4a8a2c,color:#fff
155 style SS fill:#6ab04c,stroke:#4a8a2c,color:#fff
156 style CS fill:#e17055,stroke:#c0392b,color:#fff
157 style Result fill:#f6b93b,stroke:#d4951a,color:#fff
158 ```
159
160 Even if cloning is not available, seeds are still useful. desync automatically determines if reflinks are available (and the block size used in the filesystem). If cloning is not supported, sections are copied instead of cloned. Copying still improves performance and reduces the load created by retrieving chunks over the network and decompressing them.
161
162 ### Tar Interoperability
163
164 In addition to packing local filesystem trees into catar archives, desync can read standard tar archive streams. Various tar formats such as GNU and BSD tar are supported. See the Go [archive/tar](https://pkg.go.dev/archive/tar) package for details on supported formats. When reading from tar archives, the content is not re-ordered and written to the catar in the same order. Since the catar format does not support hardlinks, the input tar stream needs to follow hardlinks for desync to process them correctly. See the `--hard-dereference` option in the tar utility.
165
166 catar archives can also be extracted to GNU tar archive streams. All files in the output stream are ordered the same as in the catar.
167
168 ## Store Backends
169
170 ### Capabilities
171
172 | Operation | Local | S3 | GCS | HTTP | SFTP | SSH (casync protocol) |
173 | --- | :---: | :---: | :---: | :---: | :---: | :---: |
174 | Read chunks | yes | yes | yes | yes | yes | yes |
175 | Write chunks | yes | yes | yes | yes | yes | no |
176 | Use as cache | yes | yes | yes | yes | yes | no |
177 | Prune | yes | yes | yes | no | yes | no |
178 | Verify | yes | no | no | no | no | no |
179
180 ### Store Architecture
181
182 ```mermaid
183 graph LR
184 Client["Client"]
185 Cache["Cache Store"]
186 Router["Store Router"]
187 S1["Store 1"]
188 FG["Failover Group"]
189 S2a["Store 2a"]
190 S2b["Store 2b"]
191
192 Client --> Cache
193 Cache -- "miss" --> Router
194 Cache -- "hit" --> Client
195 Router --> S1
196 Router --> FG
197 FG --> S2a
198 S2a -. "on failure" .-> S2b
199 S1 -- "found" --> Cache
200 FG -- "found" --> Cache
201
202 style Client fill:#6c5ce7,stroke:#4b3ec4,color:#fff
203 style Cache fill:#6ab04c,stroke:#4a8a2c,color:#fff
204 style Router fill:#4a90d9,stroke:#2a6cb0,color:#fff
205 style S1 fill:#f6b93b,stroke:#d4951a,color:#fff
206 style FG fill:#e17055,stroke:#c0392b,color:#fff
207 style S2a fill:#f6b93b,stroke:#d4951a,color:#fff
208 style S2b fill:#f6b93b,stroke:#d4951a,color:#fff
209 ```
210
211 ### Chaining and Caching
212
213 One of the main features of desync is the ability to combine/chain multiple chunk stores of different types and also combine it with a cache store. Stores are chained in the command line like so: `-s <store1> -s <store2> -s <store3>`. A chunk will first be requested from `store1`, and if not found there, the request will be routed to `store2` and so on. Typically, the fastest chunk store should be listed first to improve performance.
214
215 It is also possible to combine multiple chunk stores with a cache. In most cases the cache would be a local store, but that is not a requirement. When combining stores and a cache like so: `-s <store1> -s <store2> -c <cache>`, a chunk request will first be routed to the cache store, then to store1 followed by store2. Any chunk that is not yet in the cache will be stored there upon first request.
216
217 The `-c <store>` option can be used to either specify an existing store to act as cache or to populate a new store. Whenever a chunk is requested, it is first looked up in the cache before routing the request to the next (possibly remote) store. Any chunks downloaded from the main stores are added to the cache. In addition, when a chunk is read from the cache and it is a local store, mtime of the chunk is updated to allow for basic garbage collection based on file age. The cache store is expected to be writable. If the cache contains an invalid chunk (checksum does not match the chunk ID), the operation will fail. Invalid chunks are not skipped or removed from the cache automatically. `verify -r` can be used to evict bad chunks from a local store or cache.
218
219 ### Failover Groups
220
221 Given stores with identical content (same chunks in each), it is possible to group them in a way that provides resilience to failures. Store groups are specified in the command line using `|` as separator in the same `-s` option. For example using `-s "http://server1/|http://server2/"`, requests will normally be sent to `server1`, but if a failure is encountered, all subsequent requests will be routed to `server2`. There is no automatic fail-back. A failure in `server2` will cause it to switch back to `server1`. Any number of stores can be grouped this way. Note that a missing chunk is treated as a failure immediately, no other servers will be tried, hence the need for all grouped stores to hold the same content.
222
223 <details>
224 <summary><h3>S3 Store URLs</h3></summary>
225
226 desync supports reading from and writing to chunk stores that offer an S3 API, for example hosted in AWS or running on a local server. When using such a store, credentials are passed into the tool either via environment variables `S3_ACCESS_KEY`, `S3_SECRET_KEY` and `S3_SESSION_TOKEN` (if needed) or, if multiples are required, in the config file. Care is required when building those URLs. Below a few examples:
227
228 #### AWS
229
230 This store is hosted in `eu-west-3` in AWS. `s3` signals that the S3 protocol is to be used, `https` should be specified for SSL connections. The first path element of the URL contains the bucket, `desync.bucket` in this example. Note, when using AWS, no port should be given in the URL!
231
232 ```text
233 s3+https://s3-eu-west-3.amazonaws.com/desync.bucket
234 ```
235
236 It's possible to use prefixes (or "directories") to object names like so:
237
238 ```text
239 s3+https://s3-eu-west-3.amazonaws.com/desync.bucket/prefix
240 ```
241
242 #### Other service with S3 API
243
244 This is a store running on the local machine on port 9000 without SSL.
245
246 ```text
247 s3+http://127.0.0.1:9000/store
248 ```
249
250 #### Setting S3 bucket addressing style
251
252 desync uses [minio](https://github.com/minio/minio-go) as an S3 client library. It has an auto-detection mechanism for determining the addressing style of the buckets which should work for Amazon and Google S3 services but could potentially fail for your custom implementation. You can manually specify the addressing style by appending the "lookup" query parameter to the URL.
253
254 By default, the value of `?lookup=auto` is implied.
255
256 ```text
257 s3+http://127.0.0.1:9000/bucket/prefix?lookup=path
258 s3+https://s3.internal.company/bucket/prefix?lookup=dns
259 s3+https://example.com/bucket/prefix?lookup=auto
260 ```
261
262 </details>
263
264 <details>
265 <summary><h3>Compressed vs Uncompressed</h3></summary>
266
267 By default, desync reads and writes chunks in compressed form to all supported stores. This is in line with upstream casync's goal of storing in the most efficient way. It is however possible to change this behavior by providing desync with a config file (see [Configuration](#configuration)). Disabling compression and storing chunks uncompressed may reduce latency in some use-cases and improve performance. desync supports reading and writing uncompressed chunks to SFTP, S3, HTTP and local stores and caches. If more than one store is used, each of those can be configured independently, for example it's possible to read compressed chunks from S3 while using a local uncompressed cache for best performance. However, care needs to be taken when using the `chunk-server` command and building chains of chunk store proxies to avoid shifting the decompression load onto the server (it's possible this is actually desirable).
268
269 In the setup below, a client reads chunks from an HTTP chunk server which itself gets chunks from S3.
270
271 ```text
272 <Client> ---> <HTTP chunk server> ---> <S3 store>
273 ```
274
275 If the client configures the HTTP chunk server to be uncompressed (`chunk-server` needs to be started with the `-u` option), and the chunk server reads compressed chunks from S3, then the chunk server will have to decompress every chunk that's requested before responding to the client. If the chunk server was reading uncompressed chunks from S3, there would be no overhead.
276
277 Compressed and uncompressed chunks can live in the same store and don't interfere with each other. A store that's configured for compressed chunks by configuring it client-side will not see the uncompressed chunks that may be present. `prune` and `verify` too will ignore any chunks written in the other format. Both kinds of chunks can be accessed by multiple clients concurrently and independently.
278
279 </details>
280
281 <details>
282 <summary><h3>Chunk Encryption</h3></summary>
283
284 Chunks can be encrypted with a symmetric algorithm on a per-store basis. To use encryption, it has to be enabled in the [configuration](#configuration) file by setting `encryption` to `true` and providing a 256-bit encryption key. The key is expected hex-encoded and should be randomly generated, for example with:
285
286 ```text
287 openssl rand -hex 32
288 ```
289
290 A single instance of desync can use multiple stores at the same time, each with a different (or the same) encryption algorithm and key. Encrypted chunks are stored with file extensions containing the algorithm and a key identifier (the leading 4 bytes of the SHA256 hash of the key). If the key for a store is changed, all existing chunks in it will become "invisible" since the extension no longer matches. To change the key, chunks have to be re-encrypted with the new key, ideally into a new store. Create a new store, then either re-chunk the data, or use `desync cache -c <new-store> -s <old-store> <index>` to decrypt the chunks from the old store and re-encrypt them with the new key in the new store.
291
292 Encryption nonces are generated randomly per chunk which can weaken encryption in some modes when used on very large chunk stores, see notes below.
293
294 | ID | Algorithm | Key | Nonce/IV | Notes |
295 |:---:|:---:|:---:|:---:|:---:|
296 | `xchacha20-poly1305` | XChaCha20-Poly1305 (AEAD) | 256bit | 192bit | Default |
297 | `aes-256-gcm` | AES 256bit Galois Counter Mode (AEAD) | 256bit | 96bit | Don't use for large chunk stores (>2<sup>32</sup> chunks) |
298
299 Chunk extensions in stores are chosen based on compression or encryption settings as follows:
300
301 | Compressed | Encrypted | Extension | Example |
302 |:---:|:---:|:---:|:---:|
303 | no | no | n/a | `fbef/fbef1a00ced..9280ce78` |
304 | yes | no | `.cacnk` | `fbef/fbef1a00ced..9280ce78.cacnk` |
305 | no | yes | `.<algorithm>-<keyID>` | `fbef/fbef1a00ced..9280ce78.aes-256-gcm-635af003` |
306 | yes | yes | `.cacnk.<algorithm>-<keyID>` | `fbef/fbef1a00ced..9280ce78.cacnk.aes-256-gcm-635af003` |
307
308 Note that encryption only protects the chunk data itself. Chunk file names, which are the content hashes of the plain data, remain visible to anyone with access to the store. An observer that already knows the plain content of a chunk can therefore confirm its presence in the store.
309
310 Encryption applies to chunk stores only. Index files are always stored in plain form, and index stores reject encryption options rather than silently ignoring them. If a config entry enabling encryption matches a location that is also used to store indexes, index operations will fail with an error — keep indexes in a separate location, or use a more specific config entry without encryption for them. Keep in mind that a plain index reveals metadata about the encrypted content: the IDs, sizes and offsets of all its chunks.
311
312 Encryption provides confidentiality, while integrity comes from desync's regular chunk validation: every chunk is identified by the hash of its plain content, which is verified when chunks are read (unless `skip-verify` is set). The AEAD ciphertext is authenticated under the key, but it is not bound to the chunk's name — someone with write access to the store could swap two encrypted chunk files and decryption alone would not detect it. Such a swap is caught by the content validation of the final consumer, e.g. during `extract`, which is enabled by default. Only disable verification (`skip-verify`, `--skip-verify-read`) for intermediate proxies or caches where a downstream reader still validates the chunks.
313
314 </details>
315
316 ### Remote Indexes
317
318 Indexes can be stored and retrieved from remote locations via SFTP, S3, and HTTP. Storing indexes remotely is optional and deliberately separate from chunk storage. While it's possible to store indexes in the same location as chunks in the case of SFTP and S3, this should only be done in secured environments. The built-in HTTP chunk store (`chunk-server` command) can not be used as index server. Use the `index-server` command instead to start an index server that serves indexes and can optionally store them as well (with `-w`).
319
320 Using remote indexes, it is possible to use desync completely file-less. For example when wanting to share a large file with `mount-index`, one could read the index from an index store like this:
321
322 ```text
323 desync mount-index -s http://chunk.store/store http://index.store/myindex.caibx /mnt/image
324 ```
325
326 No file would need to be stored on disk in this case.
327
328 ## CLI Reference
329
330 The CLI tool uses the desync library and makes most features available in a consistent fashion. It does not match upstream casync's syntax exactly, but tries to be similar.
331
332 ### Commands
333
334 #### Chunking and Extraction
335
336 | Command | Description |
337 | --- | --- |
338 | `make` | Split a blob into chunks and create an index file |
339 | `extract` | Build a blob from an index file, optionally using seed indexes+blobs |
340 | `verify-index` | Verify that an index file matches a given blob |
341 | `mount-index` | FUSE mount a blob index as a single file |
342 | `cat` | Stream a blob to stdout or a file |
343 | `chunk` | Chunk input file and print chunk boundaries plus chunk IDs |
344
345 #### Archives
346
347 | Command | Description |
348 | --- | --- |
349 | `tar` | Pack a catar file, optionally chunk and create an index |
350 | `untar` | Unpack a catar file or index referencing a catar |
351 | `mtree` | Print the content of a catar, caidx, or local directory in mtree format |
352
353 #### Servers
354
355 | Command | Description |
356 | --- | --- |
357 | `chunk-server` | Start an HTTP(S) chunk server/store |
358 | `index-server` | Start an HTTP(S) index server/store |
359 | `pull` | Serve chunks using the casync protocol over stdin/stdout |
360
361 #### Inspection
362
363 | Command | Description |
364 | --- | --- |
365 | `info` | Show information about an index file |
366 | `inspect-chunks` | Show detailed information about chunks in an index and optional local store |
367 | `list-chunks` | List all chunk IDs in an index file |
368
369 #### Maintenance
370
371 | Command | Description |
372 | --- | --- |
373 | `verify` | Verify the integrity of a local store |
374 | `cache` | Populate a cache from index files without extracting |
375 | `chop` | Split a blob according to an existing index and store chunks |
376 | `prune` | Remove unreferenced chunks from a store (use with caution) |
377
378 #### Utility
379
380 | Command | Description |
381 | --- | --- |
382 | `config` | Show or write the config file |
383 | `manpage` | Generate manpages for desync |
384
385 <details>
386 <summary><h3>Common Options</h3></summary>
387
388 Not all options apply to all commands.
389
390 **Global options:**
391
392 | Option | Description |
393 | --- | --- |
394 | `--config <file>` | Path to config file. Default: `$HOME/.config/desync/config.json`. |
395 | `--digest <algorithm>` | Digest algorithm: `sha512-256` (default) or `sha256`. |
396 | `--verbose` | Enable verbose/debug logging. |
397
398 **Store options:**
399
400 | Option | Description |
401 | --- | --- |
402 | `-s <store>` | Location of the chunk store, can be local directory or a URL like `ssh://hostname/path/to/store`. Multiple stores can be specified, they'll be queried in order. The `chop`, `make`, `tar` and `prune` commands support updating chunk stores in S3, while `verify` only operates on a local store. |
403 | `-c <store>` | Location of a chunk store to be used as cache. Needs to be writable. |
404 | `-n <int>` | Number of concurrent goroutines. Default: 10. |
405 | `-t` | Trust all certificates presented by HTTPS stores. Allows the use of self-signed certs. |
406 | `--ca-cert <file>` | Trust authorities in this file instead of the OS trust store. |
407 | `--client-cert <file>` | Client certificate for mutual TLS authentication. |
408 | `--client-key <file>` | Client key for mutual TLS authentication. |
409 | `-e` / `--error-retry <int>` | Number of times to retry on network error. |
410 | `-b` / `--error-retry-base-interval <duration>` | Initial retry delay; attempt N waits N times this interval. |
411
412 **Extract options:**
413
414 | Option | Description |
415 | --- | --- |
416 | `--seed <indexfile>` | Specifies a seed file and index for the `extract` command. The tool expects the matching file to have the same name as the index file, without the `.caibx` extension. |
417 | `--seed-dir <dir>` | Specifies a directory containing seed files and their indexes for `extract`. Each index file (`*.caibx`) needs a matching blob without the extension. |
418 | `-k` / `--in-place` | Keep partially assembled files in place when `extract` fails or is interrupted. Also use this option to write to block devices. |
419 | `--print-stats` | Print extraction statistics (`extract`) or chunking statistics (`make`) to stderr. |
420 | `--skip-invalid-seeds` | Skip seeds with invalid chunks instead of failing. |
421 | `--regenerate-invalid-seeds` | Regenerate seed indexes when invalid chunks are found. |
422
423 **Chunking and archive options:**
424
425 | Option | Description |
426 | --- | --- |
427 | `-m` | Specify the min/avg/max chunk sizes in KB. Only applicable to `make`. Defaults to 16:64:256. For best results: min = avg/4, max = 4*avg. |
428 | `-i` | When packing/unpacking an archive, don't create/read an archive file but instead use an index file (caidx). Only applicable to `tar` and `untar`. |
429 | `--input-format <format>` | Input format for `tar`: `disk` (default) or `tar`. |
430 | `--output-format <format>` | Output format for `untar`: `disk` (default) or `gnu-tar`. |
431 | `--ignore <indexfile>` | Index file(s) whose chunks should be skipped. Applies to `chop` and `cache`. |
432
433 **Server options:**
434
435 | Option | Description |
436 | --- | --- |
437 | `-l <address>` | Listening address for the HTTP chunk server. Can be used multiple times for more than one interface or port. |
438 | `-w` / `--writeable` | Enable write support. Applies to `chunk-server` and `index-server`. |
439 | `-u` / `--uncompressed` | Serve uncompressed chunks. Applies to `chunk-server`. |
440 | `--store-file <file>` | Read store arguments from a JSON file; supports SIGHUP reload. Applies to `chunk-server` and `mount-index`. |
441 | `--key <file>` | Key file in PEM format for HTTPS `chunk-server` and `index-server`. Requires `--cert`. |
442 | `--cert <file>` | Certificate file in PEM format for HTTPS `chunk-server` and `index-server`. Requires `--key`. |
443 | `--mutual-tls` | Require a valid client certificate, verified against `--client-ca` (which is mandatory when this is set). Applies to `chunk-server` and `index-server`. |
444 | `--client-ca <file>` | Acceptable client certificate or CA for mutual TLS. Required when `--mutual-tls` is set; otherwise client certs would be verified against the system trust store. |
445 | `--authorization <value>` | Expected value of the Authorization header in client requests. |
446 | `--log <file>` | Request log file, or `-` for STDOUT. Applies to `chunk-server` and `index-server`. |
447
448 **Other options:**
449
450 | Option | Description |
451 | --- | --- |
452 | `-r` | Repair a local store by removing invalid chunks. Only valid for `verify`. |
453 | `-y` | Answer with `yes` when asked for confirmation. Only supported by `prune`. |
454 | `-f` / `--format <format>` | Output format for `info`: `plain` (default) or `json`. |
455
456 </details>
457
458 <details>
459 <summary><h3>Environment Variables</h3></summary>
460
461 | Variable | Description |
462 | --- | --- |
463 | `CASYNC_SSH_PATH` | Overrides the default `ssh` command when connecting to remote SSH or SFTP chunk stores. |
464 | `CASYNC_REMOTE_PATH` | Defines the command to run on the chunk store when using SSH. Default: `casync`. |
465 | `S3_ACCESS_KEY`, `S3_SECRET_KEY`, `S3_SESSION_TOKEN`, `S3_REGION` | S3 store credentials when using a single store. If `S3_ACCESS_KEY` and `S3_SECRET_KEY` are not defined, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN` are also considered. These take precedence over config file values. |
466 | `DESYNC_PROGRESSBAR_ENABLED` | Enables the progress bar if set to any non-empty value. By default, the progress bar is only shown when STDERR is a terminal. |
467 | `DESYNC_ENABLE_PARSABLE_PROGRESS` | Prints operation name, completion percentage, and estimated remaining time to STDERR. Similar to the default progress bar but without the visual bar. |
468 | `DESYNC_HTTP_AUTH` | Sets the expected `Authorization` header value from clients when using `chunk-server` or `index-server`. Needs the full string including type and encoding, e.g. `"Basic dXNlcjpwYXNzd29yZAo="`. Command-line values take precedence. |
469 | `DESYNC_ENCRYPTION_KEY` | Hex-encoded 256-bit chunk encryption key. Used for stores that have `encryption` enabled but no `encryption-key` configured, and by `chunk-server` when encryption is enabled with `--encryption` but no `--encryption-key` is given. The variable alone never enables encryption. |
470
471 </details>
472
473 ## Configuration
474
475 For most use cases, the tool's default configuration is sufficient. A config file at `$HOME/.config/desync/config.json` allows customization of timeouts, error retry behavior, or credentials that can't be set via command-line options or environment variables. All values have sensible defaults. Only add configuration for values that differ from the defaults.
476
477 To view the current configuration, use `desync config`. If no config file is present, this shows the defaults. To create a config file, use `desync config -w` to write the current configuration, then edit the file.
478
479 ### Dynamic Store Configuration
480
481 Some long-running processes, namely `chunk-server` and `mount-index`, may require reconfiguration without restart. This can be achieved by starting them with the `--store-file` option which provides the arguments normally passed via `--store` and `--cache` from a JSON file instead. A SIGHUP to the process will trigger a reload of the configuration and replace the stores internally without restart. This can be done under load. If the configuration is found to be invalid, an error is printed to STDERR and the reload is ignored.
482
483 ```json
484 {
485 "stores": [
486 "/path/to/store1",
487 "/path/to/store2"
488 ],
489 "cache": "/path/to/cache"
490 }
491 ```
492
493 This can be combined with store failover by providing the same syntax as used in the command-line, for example `{"stores":["/path/to/main|/path/to/backup"]}`. See [Server Examples](#server-examples) for details.
494
495 <details>
496 <summary><h3>Configuration Reference</h3></summary>
497
498 - **`s3-credentials`** — Credentials for S3 stores. The key must be the URL scheme and host used for the store, excluding the path, but including the port if used in the store URL. Keys can contain glob patterns (`*`, `?`, `[…]`). See [filepath.Match](https://pkg.go.dev/path/filepath#Match) for wildcard details. Standard [AWS credentials files](https://docs.aws.amazon.com/cli/latest/userguide/cli-config-files.html) are also supported.
499
500 - **`store-options`** — Per-store customization of compression, timeouts, retry behavior, and keys. Not all options apply to every store type. The store location in the command line must match the key exactly for options to apply. Glob patterns are also supported; a config file where more than one key matches a single store is considered invalid.
501
502 | Option | Description | Default |
503 | --- | --- | --- |
504 | `timeout` | Time limit for chunk read/write in nanoseconds. Negative = infinite. | 1 minute |
505 | `error-retry` | Number of times to retry failed chunk requests. | 0 |
506 | `error-retry-base-interval` | Nanoseconds to wait before first retry. Attempt N waits N times this interval. | 0 |
507 | `client-cert` | Certificate file for mutual SSL. | — |
508 | `client-key` | Key file for mutual SSL. | — |
509 | `ca-cert` | Certificate file containing trusted certs or CAs. | — |
510 | `trust-insecure` | Trust any certificate presented by the server. | false |
511 | `skip-verify` | Disable data integrity verification on read. Only recommended when chaining stores with `chunk-server` where the final consumer still verifies. Chunk validation is also what detects renamed or swapped chunks in encrypted stores, see [Chunk Encryption](#chunk-encryption). | false |
512 | `uncompressed` | Read and write uncompressed chunks. Both formats can coexist in the same store. | false |
513 | `http-auth` | Value of the `Authorization` header in HTTP requests, e.g. `"Bearer <token>"` or `"Basic dXNlcjpwYXNzd29yZAo="`. | — |
514 | `http-cookie` | Value of the `Cookie` header in HTTP requests, e.g. `"name=value; name2=value2"`. | — |
515 | `encryption` | Set to `true` to encrypt chunks in the store. See [Chunk Encryption](#chunk-encryption). | false |
516 | `encryption-key` | Hex-encoded 256-bit encryption key, e.g. generated with `openssl rand -hex 32`. Can also be provided via the `DESYNC_ENCRYPTION_KEY` environment variable. | — |
517 | `encryption-algorithm` | Encryption algorithm, `xchacha20-poly1305` or `aes-256-gcm`. | `xchacha20-poly1305` |
518
519 </details>
520
521 <details>
522 <summary><h3>Example Config</h3></summary>
523
524 #### JSON config file
525
526 ```json
527 {
528 "s3-credentials": {
529 "http://localhost": {
530 "access-key": "MYACCESSKEY",
531 "secret-key": "MYSECRETKEY"
532 },
533 "https://127.0.0.1:9000": {
534 "aws-credentials-file": "/Users/user/.aws/credentials"
535 },
536 "https://127.0.0.1:8000": {
537 "aws-credentials-file": "/Users/user/.aws/credentials",
538 "aws-profile": "profile_static"
539 },
540 "https://s3.us-west-2.amazonaws.com": {
541 "aws-credentials-file": "/Users/user/.aws/credentials",
542 "aws-region": "us-west-2",
543 "aws-profile": "profile_refreshable"
544 }
545 },
546 "store-options": {
547 "https://192.168.1.1/store": {
548 "client-cert": "/path/to/crt",
549 "client-key": "/path/to/key",
550 "error-retry": 1
551 },
552 "https://10.0.0.1/": {
553 "http-auth": "Bearer abcabcabc"
554 },
555 "https://example.com/*/*/": {
556 "http-auth": "Bearer dXNlcjpwYXNzd29yZA=="
557 },
558 "https://cdn.example.com/": {
559 "http-cookie": "PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43"
560 },
561 "/path/to/local/cache": {
562 "uncompressed": true
563 },
564 "/path/to/encrypted/store": {
565 "encryption": true,
566 "encryption-algorithm": "xchacha20-poly1305",
567 "encryption-key": "d69371915dbc4b1f0ec55e2a80f0e089accf4b32e0f8dc0e29fed7f0f30d1b26"
568 }
569 }
570 }
571 ```
572
573 #### AWS credentials file
574
575 ```ini
576 [default]
577 aws_access_key_id = DEFAULT_PROFILE_KEY
578 aws_secret_access_key = DEFAULT_PROFILE_SECRET
579
580 [profile_static]
581 aws_access_key_id = OTHERACCESSKEY
582 aws_secret_access_key = OTHERSECRETKEY
583
584 [profile_refreshable]
585 aws_access_key_id = PROFILE_REFRESHABLE_KEY
586 aws_secret_access_key = PROFILE_REFRESHABLE_SECRET
587 aws_session_token = PROFILE_REFRESHABLE_TOKEN
588 ```
589
590 </details>
591
592 ## Examples
593
594 ### Extraction
595
596 Re-assemble somefile.tar using a remote chunk store and a blob index file.
597
598 ```text
599 desync extract -s ssh://192.168.1.1/path/to/casync.store/ -c /tmp/store somefile.tar.caibx somefile.tar
600 ```
601
602 Use multiple stores, specify the local one first to improve performance.
603
604 ```text
605 desync extract -s /some/local/store -s ssh://192.168.1.1/path/to/casync.store/ somefile.tar.caibx somefile.tar
606 ```
607
608 Extract version 3 of a disk image using the previous 2 versions as seed for cloning (if supported), or copying. Note, when providing a seed like `--seed <file>.ext.caibx`, it is assumed that `<file>.ext` is available next to the index file, and matches the index.
609
610 ```text
611 desync extract -s /local/store \
612 --seed image-v1.qcow2.caibx \
613 --seed image-v2.qcow2.caibx \
614 image-v3.qcow2.caibx image-v3.qcow2
615 ```
616
617 Extract an image using several seeds present in a directory. Each of the `.caibx` files in the directory needs to have a matching blob of the same name. It is possible for the source index file to be in the same directory also (it'll be skipped automatically).
618
619 ```text
620 desync extract -s /local/store --seed-dir /path/to/images image-v3.qcow2.caibx image-v3.qcow2
621 ```
622
623 Mix and match remote stores and use a local cache store to improve performance. Also group two identical HTTP stores with `|` to provide failover in case of errors on one.
624
625 ```text
626 desync extract \
627 -s "http://192.168.1.101/casync.store/|http://192.168.1.102/casync.store/" \
628 -s ssh://192.168.1.1/path/to/casync.store/ \
629 -s https://192.168.1.3/ssl.store/ \
630 -c /path/to/cache \
631 somefile.tar.caibx somefile.tar
632 ```
633
634 Extract a file in-place (`-k` option). If this operation fails, the file will remain partially complete and can be restarted without the need to re-download chunks from the remote SFTP store. Use `-k` when a local cache is not available and the extract may be interrupted.
635
636 ```text
637 desync extract -k -s sftp://192.168.1.1/path/to/store file.caibx file.tar
638 ```
639
640 Extract an image directly onto a block device. The `-k` or `--in-place` option is needed.
641
642 ```text
643 desync extract -k -s /mnt/store image.caibx /dev/sdc
644 ```
645
646 Extract a file using a remote index stored in an HTTP index store.
647
648 ```text
649 desync extract -k -s sftp://192.168.1.1/path/to/store http://192.168.1.2/file.caibx file.tar
650 ```
651
652 ### Chunking
653
654 Split a blob, store the chunks and create an index file.
655
656 ```text
657 desync make -s /some/local/store index.caibx /some/blob
658 ```
659
660 Split a blob, create an index file and store the chunks in an S3 bucket named `store`.
661
662 ```text
663 S3_ACCESS_KEY=mykey S3_SECRET_KEY=mysecret desync make -s s3+http://127.0.0.1:9000/store index.caibx /some/blob
664 ```
665
666 Index an existing local file without creating chunks.
667
668 ```text
669 desync make image.raw.caibx /tmp/image.raw
670 ```
671
672 Verify the index you just created.
673
674 ```text
675 desync verify-index image.raw.caibx /tmp/image.raw
676 ```
677
678 ### Cache and Store Management
679
680 Verify a local cache. Errors will be reported to STDOUT, since `-r` is not given, nothing invalid will be removed.
681
682 ```text
683 desync verify -s /some/local/store
684 ```
685
686 Cache the chunks used in a couple of index files in a local store without actually writing the blob.
687
688 ```text
689 desync cache -s ssh://192.168.1.1/path/to/casync.store/ -c /local/cache somefile.tar.caibx other.file.caibx
690 ```
691
692 Copy all chunks referenced in an index file from a remote HTTP store to a remote SFTP store.
693
694 ```text
695 desync cache -s ssh://192.168.1.2/store -c sftp://192.168.1.3/path/to/store /path/to/index.caibx
696 ```
697
698 Cache chunks from remote locally with non-standard port. Ignore existing files that are available locally from seed(s). This will only download chunks from the remote if they do not exist in the seed. Works with multiple seeds.
699
700 ```text
701 desync cache -s http://cdn:9876 -c /tmp/chunkstore --ignore /tmp/indices/existing-image.raw.caibx /tmp/images/existing-image.raw
702 ```
703
704 List the chunks referenced in a caibx.
705
706 ```text
707 desync list-chunks somefile.tar.caibx
708 ```
709
710 Chop an existing file according to an existing caibx and store the chunks in a local store. This can be used to populate a local cache from a possibly large blob that already exists on the target system.
711
712 ```text
713 desync chop -s /some/local/store somefile.tar.caibx somefile.tar
714 ```
715
716 Chop a blob according to an existing index, while ignoring any chunks that are referenced in another index. This can be used to improve performance when it is known that all chunks referenced in `image-v1.caibx` are already present in the target store and can be ignored when chopping `image-v2.iso`.
717
718 ```text
719 desync chop -s /some/local/store --ignore image-v1.iso.caibx image-v2.iso.caibx image-v2.iso
720 ```
721
722 Prune a store to only contain chunks that are referenced in the provided index files. Possible data loss.
723
724 ```text
725 desync prune -s /some/local/store index1.caibx index2.caibx
726 ```
727
728 ### Archives
729
730 Pack a directory tree into a catar file.
731
732 ```text
733 desync tar archive.catar /some/dir
734 ```
735
736 Pack a directory tree into an archive and chunk the archive, producing an index file.
737
738 ```text
739 desync tar -i -s /some/local/store archive.caidx /some/dir
740 ```
741
742 Unpack a catar file.
743
744 ```text
745 desync untar archive.catar /some/dir
746 ```
747
748 Unpack a directory tree using an index file referencing a chunked archive.
749
750 ```text
751 desync untar -i -s /some/local/store archive.caidx /some/dir
752 ```
753
754 Pack a directory tree currently available as tar archive into a catar. The tar input stream can also be read from STDIN by providing `-` instead of the file name.
755
756 ```text
757 desync tar --input-format=tar archive.catar /path/to/archive.tar
758 ```
759
760 Process a tar stream into a catar. Since catar don't support hardlinks, we need to make sure those are dereferenced in the input stream.
761
762 ```text
763 tar --hard-dereference -C /path/to/dir -c . | desync tar --input-format tar archive.catar -
764 ```
765
766 Unpack a directory tree from an index file and store the output filesystem in a GNU tar file rather than the local filesystem. Instead of an archive file, the output can be given as `-` which will write to STDOUT.
767
768 ```text
769 desync untar -i -s /some/local/store --output-format=gnu-tar archive.caidx /path/to/archive.tar
770 ```
771
772 <details>
773 <summary><h3>Server Examples</h3></summary>
774
775 Start a chunk server serving up a local store via port 80.
776
777 ```text
778 desync chunk-server -s /some/local/store
779 ```
780
781 Start a chunk server on port 8080 acting as proxy for other remote HTTP and SSH stores and populate a local cache.
782
783 ```text
784 desync chunk-server -s http://192.168.1.1/ -s ssh://192.168.1.2/store -c cache -l :8080
785 ```
786
787 Start a chunk server with a store-file, this allows the configuration to be re-read on SIGHUP without restart.
788
789 ```text
790 # Create store file
791 echo '{"stores": ["http://192.168.1.1/"], "cache": "/tmp/cache"}' > stores.json
792
793 # Start the server
794 desync chunk-server --store-file stores.json -l :8080
795
796 # Modify
797 echo '{"stores": ["http://192.168.1.2/"], "cache": "/tmp/cache"}' > stores.json
798
799 # Reload
800 killall -1 desync
801 ```
802
803 Start a writable index server, chunk a file and store the index.
804
805 ```text
806 server# desync index-server -s /mnt/indexes --writeable -l :8080
807
808 client# desync make -s /some/store http://192.168.1.1:8080/file.vmdk.caibx file.vmdk
809 ```
810
811 Start a TLS chunk server on port 443 acting as proxy for a remote chunk store in AWS with local cache. The credentials for AWS are expected to be in the config file under key `https://s3-eu-west-3.amazonaws.com`.
812
813 ```text
814 desync chunk-server -s s3+https://s3-eu-west-3.amazonaws.com/desync.bucket/prefix -c cache -l 127.0.0.1:https --cert cert.pem --key key.pem
815 ```
816
817 FUSE mount an index file. This will make the indexed blob available as file underneath the mount point. The filename in the mount matches the name of the index with the extension removed. In this example `/some/mnt/` will contain one file `index`.
818
819 ```text
820 desync mount-index -s /some/local/store index.caibx /some/mnt
821 ```
822
823 FUSE mount a chunked and remote index file. First a (small) index file is read from the index-server which is used to re-assemble a larger index file and pipe it into the 2nd command that then mounts it.
824
825 ```text
826 desync cat -s http://192.168.1.1/store http://192.168.1.2/small.caibx | desync mount-index -s http://192.168.1.1/store - /mnt/point
827 ```
828
829 Long-running FUSE mount that may need to have its store setup changed without unmounting. This can be done by using the `--store-file` option rather than specifying store+cache in the command line. The process will then reload the file when a SIGHUP is sent.
830
831 ```text
832 # Create the store file
833 echo '{"stores": ["http://192.168.1.1/"], "cache": "/tmp/cache"}' > stores.json
834
835 # Start the mount
836 desync mount-index --store-file stores.json index.caibx /some/mnt
837
838 # Modify the store setup
839 echo '{"stores": ["http://192.168.1.2/"], "cache": "/tmp/cache"}' > stores.json
840
841 # Reload
842 killall -1 desync
843 ```
844
845 Show information about an index file to see how many of its chunks are present in a local store or an S3 store. The local store is queried first, S3 is only queried if the chunk is not present in the local store. The output will be in JSON format (`--format=json`) for easier processing in scripts.
846
847 ```text
848 desync info --format=json -s /tmp/store -s s3+http://127.0.0.1:9000/store /path/to/index
849 ```
850
851 Start an HTTP chunk server that will store uncompressed chunks locally, configured via JSON config file, and serve uncompressed chunks over the network (`-u` option). This chunk server could be used as a cache, minimizing latency by storing and serving uncompressed chunks. Clients will need to be configured to request uncompressed chunks from this server.
852
853 ```text
854 # Chunk server
855 echo '{"store-options": {"/path/to/store/":{"uncompressed": true}}}' > /path/to/server.json
856
857 desync --config /path/to/server.json chunk-server -w -u -s /path/to/store/ -l :8080
858
859 # Client
860 echo '{"store-options": {"http://store.host:8080/":{"uncompressed": true}}}' > /path/to/client.json
861
862 desync --config /path/to/client.json cache -s sftp://remote.host/store -c http://store.host:8080/ /path/to/blob.caibx
863 ```
864
865 HTTP chunk server using basic authorization. The server is configured to expect an `Authorization` header with the correct value in every request. The client configuration defines what the value should be on a per-server basis. The client config could be added to the default `$HOME/.config/desync/config.json` instead.
866
867 ```text
868 # Server
869 DESYNC_HTTP_AUTH="Bearer abcabcabc" desync chunk-server -s /path/to/store -l :8080
870
871 # Client
872 echo '{"store-options": {"http://127.0.0.1:8080/":{"http-auth": "Bearer abcabcabc"}}}' > /path/to/client.json
873
874 desync --config /path/to/client.json extract -s http://127.0.0.1:8080/ /path/to/blob.caibx /path/to/blob
875 ```
876
877 HTTPS chunk server using key and certificate signed by custom CA.
878
879 ```text
880 # Building the CA and server certificate
881 openssl genrsa -out ca.key 4096
882 openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.crt
883 openssl genrsa -out server.key 2048
884 openssl req -new -key server.key -out server.csr (Common Name should be the server name)
885 openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 3650 -sha256
886
887 # Chunk server
888 desync chunk-server -s /path/to/store --key server.key --cert server.crt -l :8443
889
890 # Client
891 desync extract --ca-cert ca.crt -s https://hostname:8443/ image.iso.caibx image.iso
892 ```
893
894 HTTPS chunk server with client authentication (mutual-TLS).
895
896 ```text
897 # Building the CA, server and client certificates
898 openssl genrsa -out ca.key 4096
899 openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.crt
900 openssl genrsa -out server.key 2048
901 openssl req -new -key server.key -out server.csr (Common Name should be the server name)
902 openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 3650 -sha256
903 openssl genrsa -out client.key 2048
904 openssl req -new -key client.key -out client.csr
905 openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days 3650 -sha256
906
907 # Chunk server
908 desync chunk-server -s /path/to/store --key server.key --cert server.crt --mutual-tls --client-ca ca.crt -l :8443
909
910 # Client
911 desync extract --client-key client.key --client-cert client.crt --ca-cert ca.crt -s https://hostname:8443/ image.iso.caibx image.iso
912 ```
913
914 </details>
915
916 <details>
917 <summary><h3>Update Size Estimation</h3></summary>
918
919 Get the size of the chunks that are required for an update, when using *compressed* chunks (default). I.e. how much data a client needs to download.
920
921 ```text
922 # Server
923 ## Create the update index file
924 desync make --store /some/local/store update.caibx /some/blob
925
926 ## Create a detailed JSON info file for the chunks
927 desync inspect-chunks --store /some/local/store update.caibx update_chunks_details.json
928
929 # Client
930 ## Download the update_chunks_details.json file
931 ## Get the update info
932 desync info --seed local_index.caibx --chunks-info update_chunks_details.json --format=json update.caibx
933
934 ## The value in 'dedup-size-not-in-seed-nor-cache-compressed' will hold the size in bytes that needs to be downloaded
935 ```
936
937 Get the size of the chunks that are required for an update, when using *uncompressed* chunks.
938
939 ```text
940 # Server
941 ## Create the update index file
942 desync make --store /some/local/store update.caibx /some/blob
943
944 # Client
945 ## Get the update info
946 desync info --seed local_index.caibx --format=json update.caibx
947
948 ## The value 'dedup-size-not-in-seed-nor-cache' will hold the size in bytes that needs to be downloaded
949 ```
950
951 </details>
952
953 ## Platform Support
954
955 | Platform | Status | Notes |
956 | --- | --- | --- |
957 | Linux | Full support | All features including FUSE, reflinks (Btrfs/XFS) |
958 | macOS | Supported | Minor incompatibilities possible when exchanging catar files with Linux (devices, filemodes) |
959 | Windows | Partial | Subset of commands. Device entries unsupported in tar; `--no-same-owner` and `--no-same-permissions` ignored in `untar`. |
960 | BSD | Untested | Expected to work |
961
962 ## Design Philosophy
963
964 - **Performance over storage efficiency** — where upstream casync optimizes for storage efficiency (e.g. using local files as seeds, building temporary indexes), desync optimizes for runtime performance (maintaining a local explicit chunk store, avoiding the need to reindex) at the cost of storage efficiency.
965 - **Cross-platform over platform-specific features** — where upstream casync takes full advantage of Linux platform features, desync implements a minimum feature set. High-value platform-specific features (such as Btrfs reflinks) are added while maintaining the ability to build on other platforms.
966 - **Hash functions** — both SHA512/256 and SHA256 are supported.
967 - **Compression** — only zstd compression and uncompressed stores are supported.
968 - **casync as drop-in replacement** — desync can serve as a drop-in replacement for casync on SSH servers for read-only chunk serving. Set `CASYNC_REMOTE_PATH=desync` on the client.
969 - **catar limitations** — SELinux and ACLs in existing catar files are ignored and won't be present in newly created catars. FCAPs are supported only as a verbatim copy of the `security.capability` XAttr.
970
971 ## Links
972
973 - casync — [https://github.com/systemd/casync](https://github.com/systemd/casync)
974 - Go package documentation — [https://pkg.go.dev/github.com/folbricht/desync](https://pkg.go.dev/github.com/folbricht/desync)
975 - casync blog post — [http://0pointer.net/blog/casync-a-tool-for-distributing-file-system-images.html](http://0pointer.net/blog/casync-a-tool-for-distributing-file-system-images.html)