Use it to design or check backups, or before a risky change.
Backup & Restore
Backup and restore on Linux means copying data (and enough of the system to rebuild it) to separate storage on a schedule, keeping versions, and proving that restores work.
1. What must be restorable, and how fast (RPO/RTO)?
2. Last successful backup: job log or systemctl list-timers / journalctl -u <backup>.service.
3. Databases dumped consistently (not just copied files)?
4. Off-site or immutable copy present?
5. Last restore test date and result.
data selected → consistent copy (snapshot/dump) → transferred to separate storage → versions kept → restore tested
For Backup & Restore, continue with the first unproven Topic check: Pin the exact source scope, consistency point, destination and restore point before changing anything. If that boundary is healthy, advance to the adjacent check: Read back backup metadata and content from the recovery copy rather than trusting only job output. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
tarPrimary Commands
Configuration and operational commands for this Topic.
tarReferenceCreate, inspect or extract archive streams while preserving selected filesystem metadata.
Use when: Primary lookup intent: configure. Use tar when the lookup goal is to create, inspect or extract archive streams while preserving selected filesystem metadata. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for tar: Compare extracted/archived content and metadata, then test the consuming or restore workload. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. tar is documented as an operational lookup primitive under Backup & Restore. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
gzipReferenceCompress or decompress gzip streams and files.
Use when: Primary lookup intent: configure. Use gzip when the lookup goal is to compress or decompress gzip streams and files. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for gzip: Verify decompressed content/hash and metadata, then test the consumer of the restored/compressed data. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. gzip is documented as an operational lookup primitive under Backup & Restore. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
rsyncReferenceSynchronize files and directory trees while transferring only required differences and selected metadata.
Use when: Primary lookup intent: configure. Use rsync when the lookup goal is to synchronize files and directory trees while transferring only required differences and selected metadata. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for rsync: Run a dry-run/readback comparison and verify the consuming workload or restored dataset. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. rsync is documented as an operational lookup primitive under Backup & Restore. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
ddReferenceCopy raw byte ranges between files or devices with explicit block, offset and conversion controls.
Use when: Primary lookup intent: destructive. Use dd when the lookup goal is to copy raw byte ranges between files or devices with explicit block, offset and conversion controls. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for dd: Verify target signatures/content and perform the original restore/workload integrity test. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: destructive. Safety class: destructive. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. dd is documented as an operational lookup primitive under Backup & Restore. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
backup intent/scope → source identity + consistency point → capture/copy → destination identity + retention → integrity/read-back → restore target → metadata/permissions → application/workload verification
Healthy evidence: the correct source and restore point are identified, the copy is durable and readable, required metadata is preserved, and a controlled restore passes the original acceptance test
Step 2 Commands Verify boundary
tar -czf etc-$(date +%F).tgz /etc
rsync -aHAX --delete /data/ backup:/data/
restic snapshots
Step 3 Verification and output interpretation Verify boundary
Verification path. For Git/build issues, record commit/ref, working tree, exact dependency/toolchain versions and the produced binary/library linkage. For backups, inspect completion plus expected file/object counts where useful, then perform a restore test into an isolated target and verify content/application readability. For shared-library errors, inspect the binary’s declared dependencies and actual loader resolution from the failing environment. Validate the final executable/service, not merely build command exit.
Existing fast checks for this Topic. - Pin the exact source scope, consistency point, destination and restore point before changing anything.
- Read back backup metadata and content from the recovery copy rather than trusting only job output.
- Restore into a controlled target and verify ownership, permissions, links, timestamps and application-required state.
- Repeat the original workload/recovery acceptance test and record the restore point that actually passed.
Verification chain. backup intent/scope → source identity + consistency point → capture/copy → destination identity + retention → integrity/read-back → restore target → metadata/permissions → application/workload verification
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: a job reports success but wrong scope, inconsistent source state, stale destination, missing metadata, unreadable media or an untested restore leaves recovery uncertain
It does not show unobserved data, metadata, revisions, dependencies, consumers or time periods. A backup job or copied byte count is bounded evidence only; recovery is confirmed only when the intended restore point can be read back, restored with required metadata and used successfully by the original workload.
Next check: Continue from the first unproven backup/source/build boundary, capture adjacent identity/read-back/runtime evidence, make only the demonstrated persistent change, then repeat the original workload plus a regression check.
Step 5 Common mistakes Narrow the fault
- Backups never restored in tests.
- Backups on the same disk.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
Filesystem Backup covers Linux file-tree copies and archives, including scope, consistency, metadata preservation, exclusions, sparse files, links, ACL/xattrs and destination durability.
Subtopic Restore VerificationRestore Verification proves that a selected Linux recovery point can produce the required files, metadata, configuration and application behavior on the intended target.
Follow 3-2-1: three copies, two media, one off-site (or immutable). Back up configuration (/etc), data (/home, /var/lib, databases with their own dump tools) and the package list. A backup is only proven by a restore test.
rsync -aHAX --delete --dry-run <src> <dst>— preview a metadata-preserving synctar --acls --xattrs -czf <file> <dir>— archive with ACLs and xattrssha256sum <file>— checksum to verify copiessystemctl list-timers— scheduled backup jobs
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
A backup job or copied byte count is bounded evidence only; recovery is confirmed only when the intended restore point can be read back, restored with required metadata and used successfully by the original workload.
In depth
Backup and restore on Linux: principles and tools
A backup is only useful if it can be restored, and if it contains what's needed: data, permissions, ownership, ACLs and SELinux labels. The rsync(1) manual page highlights a common gap. Archive mode (-a, which is -rlptgoD) doesn't include ACLs (-A), extended attributes (-X) or hard links (-H). The tar(1) manual page lists the matching options for archives: --acls, --xattrs and --selinux, plus --numeric-owner and --one-file-system.
The 3-2-1 rule
| Rule | Meaning |
|---|---|
| 3 copies | The original and two backups |
| 2 media | e.g. local disk and object storage |
| 1 off site | Protection against fire, theft or ransomware on the site |
Add immutability, such as object lock or append-only repositories, so an attacker with access to the host can't delete the backups.
Tools and what they're good for
| Tool | Strength |
|---|---|
| rsync | Mirroring trees; incremental transfers; hard-link snapshots (--link-dest) |
| tar | Portable archives; incremental levels (--listed-incremental) |
| restic, borg | Deduplicated, encrypted, versioned repositories |
| LVM / Btrfs / ZFS snapshots | Consistent point-in-time copies before backing up |
| Database tools (pg_dump, mysqldump, xtrabackup) | Consistent database backups |
| Enterprise software (Bacula, Veeam, NetBackup) | Central scheduling, catalogues, tape |
What to back up on a server
| Path | Why |
|---|---|
/etc | All configuration |
/srv, /var/lib/<app>, database dumps | Data |
/home, /root | User files, scripts |
| Package list | dpkg --get-selections / rpm -qa to rebuild the system |
| Not needed | /proc, /sys, /dev, /run, /tmp, caches |
host$ sudo rsync -aAXH --numeric-ids --delete --exclude-from=/etc/backup.exclude / backup1:/srv/backup/srv1/current/
host$ cat /etc/backup.exclude
/proc/*
/sys/*
/dev/*
/run/*
/tmp/*
/var/cache/*
host$ dpkg --get-selections > /etc/backup/package-selections.txt
host$ restic -r sftp:backup1:/srv/restic/srv1 snapshots --latest 3
host$ restic -r sftp:backup1:/srv/restic/srv1 restore latest --target /tmp/restore-test --include /etc/nginx
host$ diff -r /etc/nginx /tmp/restore-test/etc/nginx && echo "restore test OK"
Test restores
The last two commands restore one directory into a scratch location, and compare it with the original. Regular, documented restore tests are the only proof that the backups work. Include a full restore of one server, to a test machine, at least once a year.
Documented example, not captured output.
How it works at runtime
Backup & Restore is part of Backup & Restore. Linux Backup & Restore covers creating recoverable copies, preserving the required data and metadata, and proving recovery by restoring into a controlled target and exercising the original consumer workflow.
Runtime state ownership and mechanics. Backup and software workflows depend on source identity, dependency graph, filesystem consistency and a verifiable artifact. Git tracks repository objects/refs and working-tree/index state; compilers/linkers transform source through build inputs into binaries; dynamic loaders resolve shared libraries at runtime. Backups capture data at a point in time, but consistency and restorability depend on application quiescence, metadata and external dependencies.
Topic-specific state model. Linux Backup & Restore covers creating recoverable copies, preserving the required data and metadata, and proving recovery by restoring into a controlled target and exercising the original consumer workflow.
Technical metadata. Linux distribution + kernel + tool versions + exact source/revision or backup/restore point + destination/artifact identity + metadata/dependencies + effective runtime state + original workload result.
Interpretation rule. - Backup job success ≠ recoverable backup.
- Copied bytes ≠ complete application-consistent state.
- Snapshot or archive presence ≠ independent verified recovery copy.
- Restore command success ≠ original workload recovered.
Quick reference
Linux backup options:
| Tool | Strength |
|---|---|
| rsync | Simple file sync, incremental by file |
| tar | Archives, preserves permissions/xattrs with flags |
| restic / borg | Deduplicated, encrypted, snapshots, many backends (S3, SFTP) |
| Filesystem snapshots (LVM, Btrfs, ZFS) | Consistent point in time as backup source |
| Database tools | pg_dump, pg_basebackup, mysqldump, xtrabackup |
| Enterprise agents | Veeam Agent for Linux, Bacula/Bareos |
Back up configuration (/etc), data (/srv, /var/lib/<app>), package lists (rpm -qa, dpkg --get-selections) and service definitions — enough to rebuild the server, not just restore files.
Limits and how it fails
Primary failure point. A backup job or copied byte count is bounded evidence only; recovery is confirmed only when the intended restore point can be read back, restored with required metadata and used successfully by the original workload.
Model. A successful backup job does not show restore capability or application consistency. A clean Git working tree does not show the intended commit was deployed. Successful compilation does not show runtime loader compatibility or service behavior. A library file present on disk does not show the dynamic loader will select it. Keep source/version identity, build artifact, deployment location and running process as separate states.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Configuration intent and lifecycle. Keep build manifests/lockfiles, compiler flags, library paths and repository remotes/branches explicit. Avoid installing unmanaged build outputs over package-owned files without a deliberate ownership model. Backups should define scope, retention, credentials/encryption and application-consistency method. A restore target and procedure are part of the backup design. For dynamic libraries, prefer system-supported loader configuration over ad hoc LD_LIBRARY_PATH in broad environments.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Backup & Restore. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://download.samba.org/pub/rsync/rsync.1 · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Backup & Restore operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Backup & Restore.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Linux Backup & Restore covers creating recoverable copies, preserving the required data and metadata, and proving recovery by restoring into a controlled target and exercising the original consumer workflow. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin exact source/revision or recovery point → verify inputs/consistency → observe copy/build/link result → read back destination/artifact and metadata/dependencies → restore/run in intended environment → repeat original workload + regression check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | backup intent/scope → source identity + consistency point → capture/copy → destination identity + retention → integrity/read-back → restore target → metadata/permissions → application/workload verification | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | A backup job or copied byte count is bounded evidence only; recovery is proven only when the intended restore point can be read back, restored with required metadata and used successfully by the original workload. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux backup/source evidence can establish this proof path: backup intent/scope → source identity + consistency point → capture/copy → destination identity + retention → integrity/read-back → restore target → metadata/permissions → application/workload verification | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove unobserved data, metadata, revisions, dependencies, consumers or time periods. A backup job or copied byte count is bounded evidence only; recovery is proven only when the intended restore point can be read back, restored with required metadata and used successfully by the original workload. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven backup/source/build boundary, capture adjacent identity/read-back/runtime evidence, make only the demonstrated persistent change, then repeat the original workload plus a regression check. | Continue to the next unresolved boundary while preserving the original test condition. |
Backup & Restore · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Backup & Restore |
|---|---|
| Topic path | Backup & Restore |
| Runtime state | Linux Backup & Restore covers creating recoverable copies, preserving the required data and metadata, and proving recovery by restoring into a controlled target and exercising the original consumer workflow. |
| Fast checks | - Pin the exact source scope, consistency point, destination and restore point before changing anything. - Read back backup metadata and content from the recovery copy rather than trusting only job output. - Restore into a controlled target and verify ownership, permissions, links, timestamps and application-required state. - Repeat the original workload/recovery acceptance test and record the restore point that actually passed. |
| Verification chain | backup intent/scope → source identity + consistency point → capture/copy → destination identity + retention → integrity/read-back → restore target → metadata/permissions → application/workload verification Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | A backup job or copied byte count is bounded evidence only; recovery is proven only when the intended restore point can be read back, restored with required metadata and used successfully by the original workload. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |