This minimalist script depends only on programs from OpenBSD base. To encrypt your files use bioctl(8) with CRYPTO, openssl(1), or scrypt.

If you are looking for a deduplicating archiver, try borg(1).

Tested on OpenBSD 6.3 and 6.4

Archive with mtree(8) and pax(1)

arc is an archiver with compression. It creates a spec of the original file tree with mtree(8), then creates a compressed archive with pax(1) and gzip(1).


$ ftp -Vo ~/bin/arc https://rgz.ee/bin/arc
arc          100% |********************| 1192        00:00
$ chmod +x ~/bin/arc

Create an archive

$ arc ~/src /tmp/archive
/home/romanzolotarev/src 24080K /tmp/archive 16752K
$ ls -1 /tmp/archive*

Extract a file

Restore a single file from the archive and compare its contents with the original.

$ cd /tmp
$ pax -pe -rzf /tmp/archive ./www/arc.md
$ diff ~/src/www/arc.md ./www/arc.md

Extract all files

arc_extract restores the archive into the current directory and compares restored files with the spec created by mtree(8).

Note: time of original files in the spec is in nanoseconds, while pax(1) restores time in seconds. Therefore, we use sed(1) to cut those nanoseconds.

$ mkdir -p /tmp/restored && cd /tmp/restored
$ arc_extract /tmp/archive

or just do the same manually:

$ mkdir -p /tmp/restored && cd /tmp/restored
$ pax -pe -rzf /tmp/archive
$ gunzip < /tmp/archive.tree.gz > /tmp/archive.tree
$ sha256 < tree; cat /tmp/archive.tree.sha256
$ sed 's/time=\([0-9]*\)\.[0-9]*/time=\1.0/' /tmp/archive.tree|mtree