| Goal | Reach for |
|---|---|
| Sync files to another disk | $ rsync |
| Versioned, deduplicated backups | |
| Clone a whole disk or partition | |
| Rescue a failing drive | $ ddrescue |
| Push to cloud storage | $ rclone |
| Snapshot a live filesystem |
A backup you have never restored is only a hope. Test your restores regularly.
| Flag | Description |
|---|---|
| -a | Archive mode (preserve metadata, recurse) |
| -v | Verbose output |
| -z | Compress data during transfer |
| -h | Human-readable sizes |
| --delete | Remove extra files from destination |
| -n / --dry-run | Show what would happen, change nothing |
| --exclude | Skip matching paths |
| --progress | Show per-file progress |
Always do a `--dry-run` first when using `--delete`, so you can confirm nothing important will be wiped.
See the Compression & Archiving basics page for the full set of `tar`, `gzip`, `xz`, and `zstd` options.
| Tool | Strengths |
|---|---|
| borg | Dedup, compression, encryption, mountable archives |
| restic | Simple, fast, many cloud backends built in |
| duplicity | Encrypted incremental backups via GPG |
| bup | Git-based dedup, handles huge files well |
| rsnapshot | rsync plus hard-link rotation, no extra format |
`dd` writes wherever you point it with no confirmation. A wrong `of=` value will destroy data instantly. Check the device name twice, then once more.
| Option | Description |
|---|---|
| if= | Input file or device |
| of= | Output file or device |
| bs= | Block size (larger is usually faster) |
| status=progress | Show transfer progress |
| conv=noerror,sync | Keep going past read errors, pad blocks |
| count= | Copy only N blocks |
| System | Create a snapshot |
|---|---|
| LVM | lvcreate -s -n snap -L 5G /dev/vg/lv |
| Btrfs | btrfs subvolume snapshot / /snap |
| ZFS | zfs snapshot pool/data@backup |
Snapshots live on the same disk and are not a backup by themselves. Copy them somewhere else.
Automate the backup, but verify restores by hand on a schedule. The only proven backup is one you have successfully restored.