rdiff-backup — Incremental Backups with History
Practical guide to rdiff-backup: mirror plus reverse diffs for incremental backups with version history, locally or over SSH.
rdiff-backup merges two backup approaches into a single tool: the target holds a complete mirror of your latest state, while older versions sit alongside it as space-efficient reverse diffs. That means you can browse the most recent backup like an ordinary file copy and still roll back to any earlier point in time whenever you need to. Backups run locally or over SSH to a remote server – this guide walks you through the key commands, from your first backup to restoring a single file.
Create Backups
rdiff-backup <source> <target> — Backup a directory (mirror + incremental diffs).
rdiff-backup /home/user /backup/homerdiff-backup <source> <user>@<host>::<path> — Backup to a remote server via SSH.
rdiff-backup /var/www admin@backup-server::/backup/wwwrdiff-backup <user>@<host>::<path> <local> — Backup from a remote server to local.
rdiff-backup admin@server::/var/www /backup/wwwrdiff-backup --include '<pattern>' --exclude '**' <source> <target> — Backup only specific directories/files.
rdiff-backup --include '/home/user/Documents' --include '/home/user/.config' --exclude '**' /home/user /backup/selectiverdiff-backup --exclude '<pattern>' <source> <target> — Exclude files or directories from backup.
rdiff-backup --exclude '**/node_modules' --exclude '**/.cache' /home/user /backup/homeRestore
rdiff-backup --restore-as-of now <backup> <dest> — Restore the latest version.
rdiff-backup --restore-as-of now /backup/home /tmp/restorerdiff-backup --restore-as-of <time> <backup> <dest> — Restore from a specific point in time.
rdiff-backup --restore-as-of 3D /backup/home /tmp/restorerdiff-backup --restore-as-of <time> <backup>/<file> <dest> — Restore a specific file or directory.
rdiff-backup --restore-as-of 2D /backup/home/Documents/report.pdf /tmp/report.pdfrdiff-backup --restore-as-of '2026-03-15' <backup> <dest> — Restore from a specific date.
rdiff-backup --restore-as-of '2026-03-15' /backup/www /tmp/www-restoreTime Formats
now — Current time (latest backup).
--restore-as-of now<n>s / <n>m / <n>h / <n>D / <n>W / <n>M / <n>Y — Relative time: seconds, minutes, hours, days, weeks, months, years ago.
--restore-as-of 3D (3 days ago)YYYY-MM-DD — Absolute date.
--restore-as-of 2026-01-15YYYY-MM-DDTHH:MM:SS — Absolute date and time.
--restore-as-of 2026-01-15T14:30:00Info & Status
rdiff-backup --list-increments <backup> — List all available backup increments (restore points).
rdiff-backup --list-increments /backup/homerdiff-backup --list-increment-sizes <backup> — List increments with their sizes.
rdiff-backup --list-increment-sizes /backup/homerdiff-backup --list-at-time <time> <backup> — List files as they were at a specific time.
rdiff-backup --list-at-time 7D /backup/homerdiff-backup --list-changed-since <time> <backup> — List files changed since a specific time.
rdiff-backup --list-changed-since 1D /backup/homerdiff-backup --compare <source> <backup> — Compare source with backup and show differences.
rdiff-backup --compare /home/user /backup/homerdiff-backup --compare-at-time <time> <source> <backup> — Compare source with backup at a specific time.
rdiff-backup --compare-at-time 1D /home/user /backup/homeCleanup & Maintenance
rdiff-backup --remove-older-than <time> <backup> — Remove increments older than the specified time. Destructive – removed older states cannot be recovered.
rdiff-backup --remove-older-than 90D /backup/homerdiff-backup --remove-older-than <n>B <backup> — Keep only the last N backups (this also deletes older states permanently).
rdiff-backup --remove-older-than 5B /backup/homerdiff-backup --verify <backup> — Verify the integrity of the backup repository.
rdiff-backup --verify /backup/homerdiff-backup --force --remove-older-than <time> <backup> — Force removal even if it means removing all increments – use with care.
rdiff-backup --force --remove-older-than 30D /backup/homeCommon Patterns
rdiff-backup --exclude-globbing-filelist <file> <source> <target> — Use a file with include/exclude patterns.
rdiff-backup --exclude-globbing-filelist patterns.txt /home/user /backup/homerdiff-backup --print-statistics <source> <target> — Show detailed transfer statistics after backup.
rdiff-backup --print-statistics /home/user /backup/homerdiff-backup -v5 <source> <target> — Run with verbose output (level 0-9).
rdiff-backup -v5 /home/user /backup/homerdiff-backup --remote-schema 'ssh -p <port> %s rdiff-backup --server' <source> <user>@<host>::<path> — Use a custom SSH port for remote backup.
rdiff-backup --remote-schema 'ssh -p 2222 %s rdiff-backup --server' /data admin@server::/backup/data Conclusion
rdiff-backup is ideal when you want the instant access of a mirror combined with the safety of version history, without setting up a full-blown backup system. Schedule regular cleanup with --remove-older-than so increments don't grow without bound – and remember that this step deletes older states permanently. Verify your backups with --verify before you have to rely on them in an emergency.
Further Reading
- rdiff-backup – official project site – documentation, manual and downloads
- rdiff-backup on GitHub – source code, issues and release notes
Related Commands
- borgbackup – deduplicating, compressed and encrypted backups
- duplicity – encrypted incremental backups, including to the cloud
- rclone – sync files with cloud storage and between systems