Chunk-deduplicated backup system with differential push/pull functionality, encryption and compression.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Olivier 'reivilibre' 8a495e6926 Fully integrate node on retrieve-adv 2 months ago
src Fully integrate node on retrieve-adv 2 months ago
.drone.yml libsqlite3-dev? 7 months ago
.gitignore Works for one-off and incremental store/extract 1 year ago
Cargo.lock Add and fix tests 2 months ago
Cargo.toml Add and fix tests 2 months ago Some initial work on the yama 0.4.0 overhaul. 7 months ago
example_zstd.dict Works for one-off and incremental store/extract 1 year ago

山 (yama): deduplicated heap repository

note: this readme is not yet updated to reality…

  [-w|--with [user@host:]path] [--with-encrypted true|false]

Backup Profiles


In yama.toml, you can configure remotes:

encrypted = true
host = ""
user = "bob"
path = "/home/bob/yama"


check: Check repository for consistency

Verifies the full repository satisfies the following consistency constraints:

  • all chunks have the correct hash
  • all pointers have a valid structure, recursively

Usage: yama check [--gc]

The amount of space occupied and occupied by unused chunks is reported.

If --gc is specified, unused chunks will be removed.

lsp: List tree pointers

Usage: yama lsp

rmp: Remove tree pointers

Usage: yama rmp pointer/path [--force]

If --force is not specified and the pointer is depended upon by another, then deletion is aborted with an error.

store: Store tree into repository

Usage: yama store [--dry-run] [ssh://user@host]/path/to/dir pointer/path [--exclusions path/to/exclusions.txt] [--differential pointer/parent]

The pointer must not exist and it will be created. If --differential is specified with an existing parent pointer, then the diretory listing is specified as a differential list to the parent. The intention of this is to reduce the size of the directory list.

Exclusion lists

Exclusion lists have pretty much the same format as .gitignore, one glob per line of files to not include, relative to the tree root.

extract: Extract file(s) from repository

Usage: yama extract [--dry-run] pointer/path[:path] [ssh://user@host]/path/to/local/dir[/]

If no path specified, extract root /. Trailing slash means that the file will be extracted as a child of the specified directory.

remote: Run operations on a remote repository

Usage: yama remote ssh://user@host/path/to/repo <subcommand>

remote store: Store local tree into remote repository

Usage is identical to yama store except store path must be local.

remote extract: Extract remote repository into local tree

Usage is identical to yama extract except target path must be local.

slave: Remote-controlled yama

Communicates over stdin/stdout to perform specified operations. Used when a yama command involves SSH.

Repository Storage Details

Pointers are stored in pointers.lmdb and chunks are stored in chunks.lmdb. It is expected that exclusion files will be kept in the same directory with the repository, if they are to be used on a recurring basis.

Chunks are compressed with zstd. It must first be trained and a training dictionary placed in repo root/zstd.dict. This dictionary file must not be lost or altered after chunks have been made using it. Doing so will void the integrity of the entire repository.

Chunks are hashed with BLAKE256, and chunks will have their xxHash calculated before being deduplicated away. (Collision being detected will result in abortion of the backup. It is expected to never happen but nevertheless we may not be sure.)

Remote Protocol Details

  • Compression is performed on the host where the data resides.
  • Only required chunks are compressed and diffused across the SSH connection.
  • There needs to be some mechanism to offer, decline and accept chunks, without buffers overflowing and bringing hosts down.

Processor Details

Other notes

zstd --train FILEs -o zstd.dict

  • Candidate size: find ~/Programming -size -4k -size +64c -type f -exec grep -Iq . {} \; -printf "%s\n" | jq -s 'add'
  • Want to sample:
    • find ~/Programming -size -4k -size +64c -type f -exec grep -Iq . {} \; -exec cp {} -t /tmp/d/ \;
    • du -sh
    • find > file.list
    • wc -l < file.list → gives a № lines
    • shuf -n 4242 file.list | xargs -x zstd --train -o zstd.dict for 4242 files. Chokes if it receives a filename with a space, just re-run until you get a working set.