x3 b7f11c36b6 fix: restore files with original ownership using --chown
rsync -a with sudo restores files as root. Add --chown=$(id -u):$(id -g)
to restore commands so files get owned by the calling user.
2026-09-08 10:48:56 +00:00

x3-Backup

GTK3 Backup/Snapshot-Tool mit rsync Backend.

Erstellt platzsparende Snapshots via Hardlink-Delta, durchstoebern und wiederherstellen von Einzeldateien oder ganzen Systemen.

Features

  • rsync Snapshots — Hardlink-Delta fuer platzsparende inkrementelle Backups
  • Snapshot Sidebar — Alle Snapshots chronologisch sortiert
  • File Browser — Dateien/Ordner durchsuchen mit Berechtigungen (rwx)
  • Restore — Einzeldateien oder ganze Verzeichnisse wiederherstellen
  • System Tray — Icon im Panel mit Status und Kontextmenue
  • Live Log — Echtzeit-Ausgabe waehrend Backup/Restore
  • History Log — Komplettes Log durchsuchbar
  • Cronjob — Geplante Backups direkt aus dem Programm
  • System Backup — Komplettes Root-Filesystem sichern
  • System Restore — Aus Live-ISO wiederherstellen
  • CLI Modus — --backup, --system-backup fuer Cron/Automation

Installation

autoreconf -fi
./configure
make -j$(nproc)
sudo make install

Oder lokal bauen und starten:

autoreconf -fi && ./configure && make -j$(nproc)
./src/x3-backup

Deinstallation

sudo ./uninstall.sh

Layout

+------------------------------------------------------------------+
| x3-Backup                                          [─] [□] [×]  |
+------------------------------------------------------------------+
| File | Backup | System | Help                                    |
+------------------------------------------------------------------+
| [New Backup] [Restore] [Delete] | [Settings]     [========] 0%  |
+------------------------------------------------------------------+
|            |                                                      |
| Snapshots  |  [↑] [/home/user/documents]                          |
|            |  Select a snapshot to browse                         |
| ┌────────┐ |  ┌──────────────────────────────────────────────────┐|
| │2026-09 │ |  │ Name            │ Size   │ Permissions │ Modified │|
| │07 16:30│ |  ├─────────────────┼────────┼─────────────┼──────────┤|
| │         │ |  │ Documents       │ -      │ drwxr-xr-x  │          │|
| ├────────┤ |  │ Pictures        │ -      │ drwxr-xr-x  │          │|
| │2026-09 │ |  │ .bashrc         │ 3.4 KB │ -rw-r--r--  │          │|
| │06 02:00│ |  │ .ssh            │ -      │ drwx------  │          │|
| │         │ |  │ notes.txt       │ 12 KB  │ -rw-r--r--  │          │|
| ├────────┤ |  │ config.json     │ 1.2 KB │ -rw-r--r--  │          │|
| │2026-09 │ |  └──────────────────────────────────────────────────┘|
| │05 02:00│ |                                                      |
| └────────┘ |  ┌──────────────────────────────────────────────────┐|
|            |  │ Live Log:                                         │|
|            |  │ [cmd] rsync -aAX --info=progress2 --delete ...    │|
|            |  │ [info] Syncing: /home/user/Documents/project/     │|
|            |  │ [done] Snapshot created: 2026-09-07_16-30-00      │|
|            |  │                                                   │|
|            |  │ [Clear]                                           │|
|            |  └──────────────────────────────────────────────────┘|
+------------------------------------------------------------------+
| x3-Backup - Idle                                    Status Message|
+------------------------------------------------------------------+

Dateisystem-Struktur

Konfiguration

~/.config/x3-backup/
├── settings.json          # Einstellungen
├── x3-backup.log          # Log-Datei

Backup-Destination

/mnt/backups/                    # oder konfigurierter Pfad
├── snapshots/
│   ├── 2026-09-07_16-30-00/     # Snapshot 1 (Hardlinks)
│   │   ├── home/
│   │   │   └── user/
│   │   │       ├── documents/
│   │   │       ├── .bashrc
│   │   │       └── ...
│   │   ├── etc/
│   │   └── ...
│   ├── 2026-09-06_02-00-00/     # Snapshot 2 (nur Aenderungen)
│   │   └── ...
│   └── 2026-09-05_02-00-00/     # Snapshot 3 (aehnlich)
│       └── ...
└── metadata/
    ├── 2026-09-07_16-30-00.json # Metadaten
    ├── 2026-09-06_02-00-00.json
    └── 2026-09-05_02-00-00.json
Snapshot 1 (voll):         Snapshot 2 (delta):
  fileA (100KB) ──inode1     fileA (100KB) ──inode1  (identisch, Hardlink)
  fileB (50KB)  ──inode2     fileB (75KB)  ──inode3  (geaendert, neue Datei)
  fileC (200KB) ──inode3     fileC (200KB) ──inode3  (identisch, Hardlink)
                              fileD (30KB)  ──inode4  (neu)

Platzbedarf: voll + delta (statt 2x voll)

Config (settings.json)

{
  "backup_dest": "/mnt/backups",
  "source_path": "/",
  "exclude_patterns": [
    "/mnt",
    "/proc",
    "/sys",
    "/dev",
    "/run",
    "/tmp",
    "/lost+found"
  ],
  "preserve_permissions": true,
  "preserve_acls": true,
  "preserve_xattrs": true,
  "delete_removed": true,
  "retention_days": 30,
  "retention_count": 10,
  "cron_enabled": false,
  "cron_schedule": "0 2 * * *",
  "cron_label": "x3-backup-auto"
}

CLI Nutzung

# Backup jetzt erstellen (fragt nach sudo-Passwort)
x3-backup --backup

# Backup mit Passwort-Argument (z.B. fuer Cron)
x3-backup --backup --sudo-password "DEIN_PASSWORT"

# System-Backup (von Live-ISO)
x3-backup --system-backup --sudo-password "DEIN_PASSWORT"

# Log auf STDOUT ausgeben
x3-backup --backup --log

# Hilfe
x3-backup --help

Cronjob Beispiel

# WICHTIG: Sudo-Passwort in Datei speichern fuer Cron:
echo "DEIN_PASSWORT" > ~/.config/x3-backup/cron-pw.conf
chmod 600 ~/.config/x3-backup/cron-pw.conf

# Script fuer Cron erstellen:
cat > ~/.config/x3-backup/run-backup.sh << 'EOF'
#!/bin/bash
PW=$(cat ~/.config/x3-backup/cron-pw.conf 2>/dev/null)
/usr/local/bin/x3-backup --backup --sudo-password "$PW" >> ~/.config/x3-backup/x3-backup.log 2>&1
EOF
chmod +x ~/.config/x3-backup/run-backup.sh

# Taeglich um 2:00 Uhr
0 2 * * * ~/.config/x3-backup/run-backup.sh

# Alle 6 Stunden
0 */6 * * * ~/.config/x3-backup/run-backup.sh

# Woechentlich Sonntag 3:00 Uhr
0 3 * * 0 ~/.config/x3-backup/run-backup.sh

Log Format

[2026-09-07 16:30:00] [INFO] x3-backup: === x3-backup started ===
[2026-09-07 16:30:00] [INFO] x3-backup: Log file: ~/.config/x3-backup/x3-backup.log
[2026-09-07 16:30:01] [INFO] x3-backup: rsync cmd: rsync -aAX --info=progress2 ...
[2026-09-07 16:30:15] [INFO] x3-backup: [done] Snapshot created: 2026-09-07_16-30-00

Rechte und Wiederherstellung

Aktion Benoetigte Rechte
Backup erstellen sudo (fuer korrekte Berechtigungen)
Datei wiederherstellen sudo (fuer Root-Berechtigungen)
System wiederherstellen sudo
Cronjob installieren Normaler User (crontab -e)

Wichtig: Backups werden mit sudo ausgefuehrt, um alle Dateiberechtigungen (UID/GID, rwx, ACLs, xattrs) rekursiv korrekt zu uebernehmen. Ohne sudo waere das Backup unvollstaendig, da Root-Dateien nicht gelesen und Berechtigungen nicht preserve werden koennen.

Abhaengigkeiten

Build-Abhaengigkeiten

Ubuntu / Debian:

sudo apt install build-essential autoconf automake pkg-config libgtk-3-dev libjson-glib-dev rsync

Arch Linux:

sudo pacman -S base-devel autoconf autoconf-archive automake libtool gtk3 json-glib rsync

Gentoo Linux:

sudo emerge --ask dev-build/autoconf dev-build/automake dev-util/pkgconfig x11-libs/gtk+:3 dev-libs/json-glib net-misc/rsync

openSUSE:

sudo zypper install -y gcc-c++ autoconf automake pkg-config gtk3-devel json-glib-devel rsync

Fedora:

sudo dnf install gcc-c++ autoconf automake pkgconfig gtk3-devel json-glib-devel rsync

Laufzeit-Abhaengigkeiten

  • GTK+ 3.0 (>= 3.24)
  • json-glib-1.0
  • rsync
  • sudo (fuer Root-Rechte bei Backups)
  • crontab (optional, fuer geplante Backups)

Architektur

┌─────────────┐    ┌──────────────┐    ┌──────────────┐
│  MainWindow  │───▶│SnapshotManager│───▶│ RsyncManager │
│  (GTK UI)    │    │  (Snapshots)  │    │  (rsync)     │
└──────┬──────┘    └──────────────┘    └──────────────┘
       │
       ├── SystemTray (Tray-Icon)
       ├── SettingsDialog (Einstellungen)
       └── Config (JSON)
S
Description
GTK3 backup/snapshot tool using rsync - create, browse, and restore snapshots with ease
Readme
283 KiB
Languages
C++ 94.1%
Shell 4.4%
Makefile 0.9%
M4 0.6%