Command line / Backup and restore
Backup and restore
tinystore backup writes the whole store into one checked zip while its
program runs. tinystore restore puts a zip back into an empty directory,
checking every byte, or leaves nothing.
tinystore backup ./data backups/2026-10-19.zip
tinystore backup ./data backups/full.zip --include app.json --include-encryption-key
tinystore restore backups/2026-10-19.zip ./restored● ./restored restored from backups/2026-10-19.zip · 3 files, 52 KiBbackup
| Flag | Does |
|---|---|
--include <name> | a file of the program's own in the directory; again for more |
--include-encryption-key | the store's key too, which a backup leaves out by default |
--encryption-key-file <file> | where the store's key is, when not in the directory |
It reads beside a server or a program that holds the directory, and alone when none does. Each engine is copied as one moment of itself while it keeps working, and the zip is written beside its name and renamed once synced: a backup that fails leaves no zip.
restore
It writes only into an empty or absent directory, holding its LOCK
meanwhile, and checks each file's size, SHA-256 and CRC-32 before it names
it. A file that does not match fails the restore corrupt and leaves the
directory empty. A backup without the encryption key says so:
● ./restored restored from backups/2026-10-19.zip · 1 files, 52 KiB
its encrypted buckets open with the store's key, which the backup left out: put it back firstEvery night
#!/bin/sh
set -e
zip="/backups/chat-$(date +%F).zip"
tinystore backup /srv/chat "$zip"
tinystore restore "$zip" /tmp/restore-check && rm -rf /tmp/restore-check
find /backups -name 'chat-*.zip' -mtime +30 -deleteA restore into a scratch directory checks every byte of last night's zip. Keeping it in the Handbook does the same from a repeating job inside the program.
See also
- The command line.
- Backup: the engine's guides, restore and the key.