6.5 KiB
linux-backuper User Guide
Welcome to the linux-backuper user guide. This document explains how operators and system users can create snapshots, inspect system telemetry, compare configuration drift, extract individual files, and safely restore system states.
1. Overview & Key Concepts
linux-backuper is an enterprise Linux system snapshot and configuration backup utility written in pure Python >= 3.6 with zero mandatory external pip dependencies.
Key Highlights:
- Fast Single-Archive Format: Snapshots are single
.tar.gzarchives with a pre-indexedmanifest.jsonat the front of the archive stream, allowing instant listing and metadata inspection without unpacking. - Root-Only Security: Every snapshot is created with strict
0600permissions (root read/write only) in/var/backups/linux-backuper/. - Safe Restoration Engine: Full restores require
--force, run a dry-run plan by default (exit code 5), automatically create apre_restore_*safety snapshot before touching any file, use atomic file replacement, and protect dynamic system mounts and sockets.
2. Creating Snapshots
Snapshot creation is performed using linux-backuper snapshot:
sudo linux-backuper snapshot [OPTIONS]
Backup Profiles
linux-backuper comes with pre-configured backup profiles:
| Profile | Target Paths | Use Case |
|---|---|---|
quick (default) |
/etc/ |
Routine configuration backups, daily cronjobs, fast pre-upgrade snapshots. |
system |
/etc/, /boot/, kernel state |
Pre-kernel upgrade, bootloader changes, driver updates. |
full / dr |
/etc/, /boot/, high-value /var/ (crontabs, systemd state, NetworkManager) |
Full disaster recovery baseline before major OS migration. |
Examples:
# Quick configuration snapshot (default)
sudo linux-backuper snapshot --profile quick
# System boot and configuration snapshot
sudo linux-backuper snapshot --profile system
# Snapshot specific custom paths
sudo linux-backuper snapshot --paths /etc/nginx /etc/ssl /var/www/config
# Store without gzip compression (plain tar)
sudo linux-backuper snapshot --no-compression
# Redact passwords, shadow hashes, and SSL private keys (for sharing diagnostics)
sudo linux-backuper snapshot --sanitize
3. Listing & Inspecting Snapshots
Listing Local Snapshots
linux-backuper list
Outputs a formatted table showing snapshot IDs, creation dates, profiles, file counts, and archive sizes. Add --json for machine-readable output:
linux-backuper list --json
Inspecting Snapshot Details
To inspect metadata, host hardware, kernel parameters, network interfaces, and storage mounts recorded at snapshot time:
linux-backuper show backup_host_20261009_120000
To list all package versions installed on the system when the snapshot was taken:
linux-backuper show backup_host_20261009_120000 --packages
To list every file archived in the snapshot:
linux-backuper show backup_host_20261009_120000 --files
4. Comparing System State (Diff Engine)
The diff engine detects configuration drift and package updates.
Live System Diff
Compare the current running operating system against a past snapshot:
sudo linux-backuper diff backup_host_20261009_120000
This checks:
- Packages added, removed, or upgraded since the snapshot.
- Files added, modified, or deleted in configuration trees.
To inspect line-by-line differences in modified configuration files, use -u or --unified:
sudo linux-backuper diff backup_host_20261009_120000 --unified
Snapshot-to-Snapshot Diff
Compare two distinct snapshots to see what changed between maintenance windows:
linux-backuper diff backup_host_20261001_100000 backup_host_20261009_120000 --unified
5. Selective Single-File Extraction
If an accidental edit broke a single configuration file (e.g. /etc/ssh/sshd_config), you do not need to restore the whole system. Extract the specific file directly:
sudo linux-backuper extract backup_host_20261009_120000 \
--file /etc/ssh/sshd_config \
--out /tmp/sshd_config.recovered
linux-backuper extract features strict Zip Slip / Path Traversal protection to ensure files are never extracted outside the requested output target.
6. Safe System Restoration
Full restores are protected by multiple safety guardrails:
Step 1: Dry-Run Simulation (Default)
Running restore without --force prints a complete execution plan and exits with status code 5:
sudo linux-backuper restore backup_host_20261009_120000 --dry-run
Output summarizes:
- Files to be updated, added, or deleted.
- Volatile sockets, FIFOs, and dynamic mounts skipped automatically (
/etc/resolv.conf,/etc/mtab,/run/).
Step 2: Live Restoration (--force)
When satisfied with the dry-run, execute the restore with --force:
sudo linux-backuper restore backup_host_20261009_120000 --force
Safety Guarantees During Live Restore:
- Automated Safety Snapshot:
linux-backuperimmediately captures a fullpre_restore_<timestamp>snapshot before modifying any system file. If needed, you can roll back instantly. - Atomic File Replacement: Files are written to temporary staging files (
.linux_backuper_restore.*) and moved into place via atomicos.replaceto prevent corrupted configurations if interrupted. - SELinux Auto-Relabeling: On SELinux-enforcing systems (RHEL, AlmaLinux, CentOS, Fedora),
restorecon -Ris automatically executed on all restored trees to ensure correct security contexts. - Fstab Safety Guard: Restoring
/etc/fstabis blocked by default to prevent boot failures. If you specifically intend to restore fstab, provide--include-fstab.
7. Cryptographic Integrity Verification
To verify that an archive has not been corrupted or tampered with:
linux-backuper verify backup_host_20261009_120000
This validates:
- The SHA-256 cryptographic digest against the embedded archive manifest.
- The gzip compression stream integrity.
- The tar entry checksums and header formatting.
8. Shell Autocompletion
linux-backuper supports full tab completion for Bash and Zsh, including automatic dynamic completion of snapshot IDs:
# Enable in current Bash session:
source <(linux-backuper completion bash)
# Persist system-wide for Bash:
linux-backuper completion bash | sudo tee /usr/share/bash-completion/completions/linux-backuper > /dev/null
# Persist for Zsh:
linux-backuper completion zsh | sudo tee /usr/share/zsh/site-functions/_linux-backuper > /dev/null