Skip to content

timlinux/zfs-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Kartoza ZFS Backup Tool

A beautiful TUI (Terminal User Interface) for managing ZFS backups, built with Bubble Tea and Lipgloss.

Release License Documentation

📖 Full Documentation

Features

  • Incremental Backups - Efficient snapshots of ALL datasets with syncoid integration
  • Multi-Host Backups - Back up multiple machines to the same drive with hostname namespacing
  • Pull Remote Backup - Pull ZFS snapshots from remote servers via SSH
  • Push Backup to Remote - Push local snapshots to a remote backup server via SSH
  • Force Backup - Destructive backup option for out-of-sync scenarios
  • Restore Files - Dual-panel file explorer to browse snapshots and restore files
  • Pool Information - View detailed pool structure, health, datasets, and snapshots
  • Pool Maintenance - Start, stop, and monitor scrub operations
  • Device Preparation - Create encrypted ZFS pools with AES-256-GCM
  • Safe Unmounting - Properly export pools and power off USB drives
  • Smart Pool Defaults - Auto-detects source/destination pools based on naming
  • Saved Host Profiles - Remote hosts are persisted for quick reuse
  • CLI Mode - Command-line arguments for automation and scripting

Backup Modalities

Local Backup (to external USB drive)

graph LR
    subgraph "Local Machine"
        A[NIXROOT/home]
        B[NIXROOT/nix]
        C[NIXROOT/root]
    end
    subgraph "USB Backup Drive"
        D[NIXBACKUPS/abyss/home]
        E[NIXBACKUPS/abyss/nix]
        F[NIXBACKUPS/abyss/root]
    end
    A -->|syncoid| D
    B -->|syncoid| E
    C -->|syncoid| F
Loading

Pull Remote Backup (remote server to local drive)

graph LR
    subgraph "Remote Server (myserver)"
        A[NIXROOT/home]
        B[NIXROOT/nix]
    end
    subgraph "Local USB Backup Drive"
        D[NIXBACKUPS/myserver/home]
        E[NIXBACKUPS/myserver/nix]
    end
    A -->|"syncoid (SSH pull)"| D
    B -->|"syncoid (SSH pull)"| E
Loading

Push Backup (local to remote backup server)

graph LR
    subgraph "Local Machine"
        A[NIXROOT/home]
        B[NIXROOT/nix]
    end
    subgraph "Remote Backup Server"
        D[NIXBACKUPS/abyss/home]
        E[NIXBACKUPS/abyss/nix]
    end
    A -->|"syncoid (SSH push)"| D
    B -->|"syncoid (SSH push)"| E
Loading

Multi-Host on Same Drive

graph TB
    subgraph "USB Backup Drive (NIXBACKUPS)"
        subgraph "abyss (laptop)"
            A1[home]
            A2[nix]
            A3[root]
        end
        subgraph "myserver (remote)"
            B1[home]
            B2[nix]
            B3[data]
        end
        subgraph "workstation (remote)"
            C1[home]
            C2[projects]
        end
    end
Loading

All datasets are namespaced by hostname, allowing multiple machines to share one backup drive without conflicts. Backward-compatible with existing flat NIXBACKUPS/home layouts.

Quick Start

Install

# Download binary (Linux x86_64)
curl -L https://github.com/timlinux/zfs-backup/releases/latest/download/zfs-backup-linux-amd64 -o zfs-backup
chmod +x zfs-backup
sudo mv zfs-backup /usr/local/bin/

# Or with Nix
nix run github:timlinux/zfs-backup

See Installation Guide for more options including NixOS, Arch (AUR), Debian, Fedora, Snap, and Flatpak.

Run

# Interactive mode
sudo zfs-backup

# CLI mode
sudo zfs-backup --backup      # Run incremental backup
sudo zfs-backup --unmount     # Safely unmount backup drive
sudo zfs-backup --help        # Show help

Requirements

  • Linux with ZFS filesystem
  • syncoid (from sanoid package)
  • Root privileges or ZFS delegation configured
  • External drive with encrypted ZFS pool (for backups)

Menu Options

Option Description
Backup ZFS (incremental) Run efficient incremental backup of all local datasets
Pull Remote Backup Pull backup from a remote host via SSH
Push Backup to Remote Push local snapshots to a remote backup server
Restore Files Browse snapshots and restore individual files
Show zpool info View pool structure, health, datasets, and snapshots
Pool Maintenance Start/stop scrubs, monitor pool health
Recover Failed Backup Fix broken sync state after interruption
Unmount Backup Disk Safely export pool and power off USB drive
Prepare Backup Device Create new encrypted ZFS pool on external drive
Force Backup (destructive) Reset backup when incremental chain is broken

Keyboard Shortcuts

Navigation

Key Action
↑/k ↓/j Navigate
Enter Select
Esc Go back
q Quit

Scrollable Views (Pool Info, Maintenance, Results)

Key Action
j/k Scroll line
Ctrl+u/d Page up/down
g/G Top/bottom

Restore Mode

Key Action
Tab or h/l Switch panels
Space Toggle selection
y Copy selected files
/ Search
m Create directory

See Full Keyboard Reference.

Documentation

Architecture

zfs-backup/
├── main.go       # Bubble Tea TUI and main application logic
├── zfs.go        # ZFS operations (backup, prepare, unmount)
├── state.go      # Backup state management for resume
├── restore.go    # Restore mode with dual-panel explorer
├── flake.nix     # Nix flake configuration
└── docs/         # MkDocs documentation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

See Contributing Guide.

License

MIT License - see LICENSE file for details.


Made with <3 by Kartoza | Donate! | GitHub

About

Beautiful TUI for managing ZFS backups with Bubble Tea

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages