Warning: This project is a prototype and is not ready for production use. Test your backups and restores before relying on it for important data.
dwmc-backup is a small Deno command-line tool for creating compressed incremental filesystem backups and restoring a selected backup point. It uses GNU tar snapshot metadata to store only changes after the first backup.
- Incremental backups with GNU tar's
--listed-incrementalformat - Parallel gzip compression with
pigz - Timestamped backup archives
- Interactive restore-point selection with
fzf - Restore into a separate directory without overwriting the source
- TOML configuration in the user's home directory
- Activity and error logs
- Standalone binary and Docker-based build options
- A Unix-like operating system
- Deno to run from source or compile the binary
- GNU
tar pigzfzf- Docker, only if using the Docker helper
All three runtime tools must be available on PATH, including fzf when creating backups.
For Debian or Ubuntu:
sudo apt install tar pigz fzfCreate ~/.dwmc-backup.conf with absolute paths:
SOURCE_DIR = '/home/user/documents'
BACKUP_DIR = '/mnt/backups/documents'SOURCE_DIRis the directory to back up and must already exist.BACKUP_DIRstores archives, metadata, logs, and restored files. It is created automatically when missing.- Keep
BACKUP_DIRoutsideSOURCE_DIRto prevent backups from including themselves.
If the configuration file is missing, the program offers to create a template and then exits so that you can edit it.
Create a backup:
deno task run backupRestore a backup point:
deno task run restoredeno task compileThe command creates dwmc-backup.bin. Deno is not required to run the compiled binary, but GNU tar, pigz, and fzf are still required.
./dwmc-backup.bin backup
./dwmc-backup.bin restoreThe helper script must currently be run from the scripts directory:
cd scripts
./docker-deno.sh compile
./docker-deno.sh run backupThe container only mounts the project directory. A host SOURCE_DIR or BACKUP_DIR is unavailable inside the container unless the script is extended with the required volume mounts. The compiled binary is therefore the most practical Docker-generated artifact for normal host use.
The first backup command creates a full archive and backup.snar, the GNU tar snapshot metadata file. Each later command uses that metadata to create an incremental archive containing changes since the previous backup.
Archives are written as:
BACKUP_DIR/snapshots/backup_<unix-timestamp>.tar.gz
Treat backup.snar and every archive in snapshots/ as one backup set. Do not delete an intermediate archive: later restore points depend on the complete chain.
Run the restore command and select an archive in fzf:
deno task run restoreThe program then:
- Deletes any existing
BACKUP_DIR/restoredirectory. - Recreates the restore directory.
- Extracts archives in order, from the first backup through the selected backup.
- Leaves the recovered tree under
BACKUP_DIR/restorefor inspection or manual copying.
The source directory is not modified. Always inspect the restored data before replacing live files.
BACKUP_DIR/
|-- backup.snar
|-- snapshots/
| `-- backup_<unix-timestamp>.tar.gz
|-- restore/
|-- _backup.log
`-- _error.log
backup.snar: state used to create the incremental chainsnapshots/: compressed backup archivesrestore/: reconstructed files from the latest restore operation_backup.log: backup and restore activity_error.log: runtime errors and stack traces
- Run only one backup at a time. Concurrent runs can corrupt snapshot state or overwrite archives created in the same second.
- Back up the entire
BACKUP_DIR, includingbackup.snar, when copying a backup set elsewhere. - The project does not provide scheduling, retention, pruning, encryption, remote storage, archive verification, or locking.
- Regularly perform test restores and verify the recovered files.
- Review
_error.logafter a failed operation.
The implementation is contained in main.ts. Deno tasks are defined in deno.json, and dependency versions are recorded in deno.lock.
deno task run backup
deno task compileThere is currently no automated test suite or release workflow.
Licensed under the MIT License.