Pcornel
Linux · Backup & Restore

Filesystem Backup

Cheat sheet · https://pcornel.dk/topic.php?topic=2903

Back to the Topic

Answer

Filesystem backup copies files with their metadata (owner, permissions, ACLs, xattrs, SELinux labels, hard links) using tools like rsync, tar, Borg, restic or filesystem snapshots.

Remember

Preserve metadata: rsync -aHAX, tar --acls --xattrs --selinux. Use snapshots (LVM, Btrfs) for consistency on busy filesystems. Exclude /proc, /sys, /dev, /run and caches. Encrypt off-site copies.

First checks

  • rsync -aHAX --delete --dry-run <src> <dst> — preview a metadata-preserving sync
  • tar --acls --xattrs -czf <file> <dir> — archive with ACLs and xattrs
  • sha256sum <file> — checksum to verify copies
  • systemctl list-timers — scheduled backup jobs

Verify in this order

snapshot/quiesce → copy with metadata → store versioned and off-site → logs record success

Where it usually breaks

First mismatch in persistent intent → provider/parser/generator → kernel/userspace runtime → dependency/security context → logs/counters → consumer-visible read-back; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2903

Confirmation

Confirm action

Continue?