diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-27 06:17:29 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-27 06:17:29 -0600 |
| commit | aa89a46820f0a27df88a3717c987ac31cbb2f940 (patch) | |
| tree | 4db7ba367f6c28521662847a88ab731f6d6f9f8c /assets/2026-01-17-zfs-sanoid-feature-request.txt | |
| parent | 74e7b5071b5cd8cffd404fe165eebe712d9ffd02 (diff) | |
chore(assets): reorganize into outbox and wireguard-config
Move processed inbox files to assets/outbox/, rename assets/wireguard
to assets/wireguard-config, delete unused dwm.desktop.
Diffstat (limited to 'assets/2026-01-17-zfs-sanoid-feature-request.txt')
| -rw-r--r-- | assets/2026-01-17-zfs-sanoid-feature-request.txt | 202 |
1 files changed, 0 insertions, 202 deletions
diff --git a/assets/2026-01-17-zfs-sanoid-feature-request.txt b/assets/2026-01-17-zfs-sanoid-feature-request.txt deleted file mode 100644 index 87207f2..0000000 --- a/assets/2026-01-17-zfs-sanoid-feature-request.txt +++ /dev/null @@ -1,202 +0,0 @@ -ZFS Detection and Sanoid Installation -====================================== - -When archsetup runs, it should detect if the system is on ZFS and install sanoid. - -Detection: -- Check if root filesystem is ZFS: `findmnt -n -o FSTYPE /` returns "zfs" -- Or check if zpool exists: `zpool list -H 2>/dev/null` - -If ZFS detected: -1. Install sanoid from AUR: `yay -S sanoid` -2. Create /etc/sanoid/sanoid.conf (see below) -3. Enable the timer: `systemctl enable --now sanoid.timer` -4. Create the syncoid replication script and systemd units (see below) - -Context: -- install-archzfs can't install sanoid (AUR package) -- archsetup already has AUR helper setup, so it's the right place to install it -- syncoid (for TrueNAS replication) comes with the sanoid package - -Added: 2026-01-17 - -================================================================================ -SANOID CONFIGURATION (/etc/sanoid/sanoid.conf) -================================================================================ - -# Sanoid configuration for ZFS snapshots -# Less aggressive - TrueNAS handles long-term backups - -############################# -# Templates -############################# - -[template_production] - # Local rollback capability - hourly = 6 - daily = 7 - weekly = 2 - monthly = 1 - autosnap = yes - autoprune = yes - -[template_backup] - # Less frequent for large/static data - hourly = 0 - daily = 3 - weekly = 2 - monthly = 1 - autosnap = yes - autoprune = yes - -[template_none] - autosnap = no - autoprune = yes - -############################# -# Datasets -############################# - -[zroot/ROOT/default] - use_template = production - -[zroot/home] - use_template = production - recursive = yes - -[zroot/media] - use_template = backup - -[zroot/vms] - use_template = backup - -[zroot/var/log] - use_template = production - -[zroot/var/lib/pacman] - use_template = production - -[zroot/var/cache] - use_template = none - -[zroot/var/tmp] - use_template = none - -[zroot/tmp] - use_template = none - -================================================================================ -SYNCOID REPLICATION SCRIPT (/usr/local/bin/zfs-replicate) -================================================================================ - -#!/bin/bash -# zfs-replicate - Replicate ZFS datasets to TrueNAS -# -# Usage: -# zfs-replicate # Replicate all configured datasets -# zfs-replicate [dataset] # Replicate specific dataset - -set -e - -# TrueNAS Configuration -# Try local network first, fall back to tailscale -TRUENAS_LOCAL="truenas.local" -TRUENAS_TAILSCALE="truenas" -TRUENAS_USER="root" -TRUENAS_POOL="vault" -BACKUP_PATH="backups" # TODO: Configure actual path - -# Datasets to replicate -DATASETS="zroot/ROOT/default zroot/home zroot/media zroot/vms" - -# Colors -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' - -info() { echo -e "${GREEN}[INFO]${NC} $1"; } -warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } -error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; } - -command -v syncoid >/dev/null 2>&1 || error "syncoid not found. Install sanoid package." - -# Determine which host to use -determine_host() { - if ping -c 1 -W 2 "$TRUENAS_LOCAL" &>/dev/null; then - echo "$TRUENAS_LOCAL" - elif ping -c 1 -W 2 "$TRUENAS_TAILSCALE" &>/dev/null; then - echo "$TRUENAS_TAILSCALE" - else - error "Cannot reach TrueNAS at $TRUENAS_LOCAL or $TRUENAS_TAILSCALE" - fi -} - -TRUENAS_HOST=$(determine_host) -info "Using TrueNAS host: $TRUENAS_HOST" - -# Single dataset mode -if [[ -n "$1" ]]; then - dataset="$1" - dest="$TRUENAS_USER@$TRUENAS_HOST:$TRUENAS_POOL/$BACKUP_PATH/${dataset#zroot/}" - info "Replicating $dataset -> $dest" - syncoid --recursive "$dataset" "$dest" - exit 0 -fi - -# Full replication -info "Starting ZFS replication to $TRUENAS_HOST" -echo "" - -for dataset in $DATASETS; do - dest="$TRUENAS_USER@$TRUENAS_HOST:$TRUENAS_POOL/$BACKUP_PATH/${dataset#zroot/}" - info "Replicating $dataset -> $dest" - - if syncoid --recursive "$dataset" "$dest"; then - info " Success" - else - warn " Failed (will retry next run)" - fi - echo "" -done - -info "Replication complete." - -================================================================================ -SYSTEMD SERVICE (/etc/systemd/system/zfs-replicate.service) -================================================================================ - -[Unit] -Description=ZFS Replication to TrueNAS -After=network-online.target -Wants=network-online.target - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/zfs-replicate -User=root - -[Install] -WantedBy=multi-user.target - -================================================================================ -SYSTEMD TIMER (/etc/systemd/system/zfs-replicate.timer) -================================================================================ - -[Unit] -Description=Run ZFS replication nightly - -[Timer] -OnCalendar=*-*-* 02:00:00 -RandomizedDelaySec=1800 -Persistent=true - -[Install] -WantedBy=timers.target - -================================================================================ -ENABLE REPLICATION -================================================================================ - -After SSH key auth is set up to TrueNAS: - systemctl enable --now zfs-replicate.timer |
