UNAS-Pro Backup Migration Plan: SMB (Push) to Native Rsync Daemon (Pull)#

Antigravity Chat: agy –conversation=4c0c9b6d-2722-4fd6-a4aa-638c75ab46f4

This document is the complete master migration plan for transitioning the UNAS-Pro backup strategy from the UniFi Drive UI-managed SMB (Push) setup to a Native Rsync Daemon (Pull) model.

Because the UniFi Drive UI natively supports Rsync server settings and shared folder modules, migrating to Rsync requires configuring your TrueNAS SCALE servers (HP1, HP2, HP3, HP7, HP8) to pull the backups directly from the UNAS-Pro Rsync daemon over TCP port 873.

This pull configuration gives you absolute control over the file structure, allowing you to completely bypass the UNAS Pro_HP* master folders and sync directories directly to the root of your TrueNAS datasets.


1. Backup Inventory & Master Schedule Matrix#

πŸ•’ Master Production Cron Schedule (24/7 Hourly Offset Matrix)#

All TrueNAS pull backup cron tasks run 24/7 on an hourly schedule with staggered minute offsets to eliminate network and I/O contention on the UNAS-Pro master NAS:

Node Host IP Target Path / Dataset Modules Pulled Cron Schedule Minute Offset Status
HP1 10.1.2.201 /mnt/RaidZ1SSDPool8TB/HP1UNASBackup/ Books, Photos, Nadine, [Immich](Immich.md), Musique, Software, HomesDSM, Documents, Downloads, GoogleCloudSync 0 * * * * Minute 00 LIVE & ACTIVE
HP2 10.1.2.212 /mnt/Raid0SSDPool3TB/HP2UNASBackup/ Books, Immich, Nadine, Photos, Musique, Software, HomesDSM, Documents 20 * * * * Minute 20 LIVE & ACTIVE
HP3 10.1.2.213 /mnt/Medias/HP3Medias/ Films, TVSeries 50 * * * * Minute 50 LIVE & ACTIVE
HP7 10.1.1.17 /mnt/Stripe4TB/HP7UNASBackup/ Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, GoogleCloudSync 30 * * * * Minute 30 LIVE & ACTIVE
HP8 10.1.2.208 /mnt/RaidZ1SSDPool8TB/HP8UNASBackup//mnt/Medias/HP8Medias/ Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, GoogleCloudSync, Films, TVSeries 15 * * * * Minute 15 LIVE & ACTIVE

πŸ“‹ Full Backup Inventory & Dataset Mapping#

Task Name Target Host Target Path / Dataset Current Source Folders Rsync Module Equivalent Active Production Schedule
HP1 10.1.2.201 /mnt/RaidZ1SSDPool8TB/HP1UNASBackup 10 shared folders Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, Downloads, GoogleCloudSync Hourly at minute 0 (0 * * * *)
HP2 10.1.2.212 /mnt/Raid0SSDPool3TB/HP2UNASBackup 8 shared folders Books, Immich, Nadine, Photos, Musique, Software, HomesDSM, Documents Hourly at minute 20 (20 * * * *)
HP3 10.1.2.213 /mnt/Medias/HP3Medias /shared/Films/shared/TVSeries FilmsTVSeries Hourly at minute 50 (50 * * * *)
HP7 10.1.1.17 /mnt/Stripe4TB/HP7UNASBackup 9 shared folders Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, GoogleCloudSync Hourly at minute 30 (30 * * * *)
HP8 10.1.2.208 /mnt/RaidZ1SSDPool8TB/HP8UNASBackup/mnt/Medias/HP8Medias 11 shared folders Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, GoogleCloudSync, Films, TVSeries Hourly at minute 15 (15 * * * *)

1.1 Quick Reference: Consulting & Monitoring Log Files#

Every host stores timestamped execution logs (YYYY-MM-DD_HH-MM_unas_backup.log) in its unas_backup user directory. Old logs beyond 30 days are automatically pruned during each backup run.

πŸ“‹ Log Directories & One-Liner Viewing Commands#

Host IP Address Log Directory Path One-Liner to View Latest Log (Tail 50 lines)
HP1 10.1.2.201 /mnt/homes/unas_backup/ ssh marcoue@10.1.2.201 "sudo ls -t /mnt/homes/unas_backup/*_unas_backup.log | head -n 1 | xargs sudo tail -n 50"
HP2 10.1.2.212 /mnt/Homes/unas_backup/unas_backup/ ssh marcoue@10.1.2.212 "sudo ls -t /mnt/Homes/unas_backup/unas_backup/*_unas_backup.log | head -n 1 | xargs sudo tail -n 50"
HP3 10.1.2.213 /mnt/Homes/unas_backup/unas_backup/ ssh marcoue@10.1.2.213 "sudo ls -t /mnt/Homes/unas_backup/unas_backup/*_unas_backup.log | head -n 1 | xargs sudo tail -n 50"
HP7 10.1.1.17 /mnt/homes/unas_backup/ ssh marcoue@10.1.1.17 "sudo ls -t /mnt/homes/unas_backup/*_unas_backup.log | head -n 1 | xargs sudo tail -n 50"
HP8 10.1.2.208 /mnt/homes/unas_backup/ ssh marcoue@10.1.2.208 "sudo ls -t /mnt/homes/unas_backup/*_unas_backup.log | head -n 1 | xargs sudo tail -n 50"

πŸ› οΈ Handy Log Command Snippets#

  • View the latest run’s summary & transfer speed (HP2 example):
    ssh marcoue@10.1.2.212 "sudo ls -t /mnt/Homes/unas_backup/unas_backup/*_unas_backup.log | head -n 1 | xargs sudo tail -n 30"
  • Follow live output during an ongoing backup run (HP1 example):
    ssh marcoue@10.1.2.201 "sudo ls -t /mnt/homes/unas_backup/*_unas_backup.log | head -n 1 | xargs sudo tail -f"
  • Search all logs for rsync warnings or errors (HP3 example):
    ssh marcoue@10.1.2.213 "sudo grep -iE 'error|failed|denied|warning' /mnt/Homes/unas_backup/unas_backup/*.log"

2. Phase 0: Prerequisite β€” TrueNAS MCP Server Architecture (Git & 1Password Pipeline)#

Following the official homelab architecture in AI - MCP Configuration Guide, all TrueNAS MCP servers are defined in the master Git repository at ~/.mcp-config/config.json, wrapped in 1Password CLI references (op://Homelab-MCP/MCP-Secrets/...), compiled via custom FastMCP, and deployed across all AI clients (antigravity-cli, antigravity-2.0, pi, antigravity-ide, claude-code) via apply.py.

βš™οΈ Complete Master Fleet Config (~/.mcp-config/config.json)#

{
  "mcpServers": {
    "truenas-hp1": {
      "command": "/opt/homebrew/bin/op",
      "args": [
        "run",
        "--",
        "uvx",
        "truenas-mcp-server"
      ],
      "env": {
        "TRUENAS_URL": "https://10.1.2.201",
        "TRUENAS_API_KEY": "op://Homelab-MCP/MCP-Secrets/HP1_TRUENAS_API_KEY",
        "TRUENAS_VERIFY_SSL": "false"
      }
    },
    "truenas-hp2": {
      "command": "/opt/homebrew/bin/op",
      "args": [
        "run",
        "--",
        "uvx",
        "truenas-mcp-server"
      ],
      "env": {
        "TRUENAS_URL": "https://10.1.2.212",
        "TRUENAS_API_KEY": "op://Homelab-MCP/MCP-Secrets/HP2_TRUENAS_API_KEY",
        "TRUENAS_VERIFY_SSL": "false"
      }
    },
    "truenas-hp3": {
      "command": "/opt/homebrew/bin/op",
      "args": [
        "run",
        "--",
        "uvx",
        "truenas-mcp-server"
      ],
      "env": {
        "TRUENAS_URL": "https://10.1.2.213",
        "TRUENAS_API_KEY": "op://Homelab-MCP/MCP-Secrets/HP3_TRUENAS_API_KEY",
        "TRUENAS_VERIFY_SSL": "false"
      }
    },
    "truenas-hp7": {
      "command": "/opt/homebrew/bin/op",
      "args": [
        "run",
        "--",
        "uvx",
        "truenas-mcp-server"
      ],
      "env": {
        "TRUENAS_URL": "https://10.1.1.17",
        "TRUENAS_API_KEY": "op://Homelab-MCP/MCP-Secrets/HP7_TRUENAS_API_KEY",
        "TRUENAS_VERIFY_SSL": "false"
      }
    },
    "truenas-hp8": {
      "command": "/opt/homebrew/bin/op",
      "args": [
        "run",
        "--",
        "uvx",
        "truenas-mcp-server"
      ],
      "env": {
        "TRUENAS_URL": "https://10.1.2.208",
        "TRUENAS_API_KEY": "op://Homelab-MCP/MCP-Secrets/HP8_TRUENAS_API_KEY",
        "TRUENAS_VERIFY_SSL": "false"
      }
    }
  }
}

Server-specific API key generation, 1Password vault creation (op://Homelab-MCP/MCP-Secrets/HPX_TRUENAS_API_KEY), and MCP fleet connectivity verification are embedded directly as prerequisite tasks within each TrueNAS server’s migration checklist below.


3. Production Server Migration Checklists#

Once prerequisites are configured, perform the checklists below on each production TrueNAS node to migrate your live data.

Folder Structure & TrueNAS UI Task Options:

  • Folder Structure: Each Rsync module pulled from the UNAS-Pro lands as its own named subfolder within the destination dataset (e.g., pulling Books to /mnt/.../HP1UNASBackup/ results in /mnt/.../HP1UNASBackup/Books/).
  • Option A β€” Consolidated System Cron Job (System Settings > Advanced > Cron Jobs) [Default]: Uses 1 single script per server running a for loop across all exposed modules sequentially. Easy to manage as 1 entry per host.
  • Option B β€” Native TrueNAS Rsync Tasks (Data Protection > Rsync Tasks): Uses TrueNAS middleware Rsync Task objects (1 entry per module, e.g. 10 entries for HP1) with native UI status badges under Data Protection.

πŸ“‹ Node: HP1 (10.1.2.201)#

  • Pool Name: RaidZ1SSDPool8TB
  • Dataset Path: /mnt/RaidZ1SSDPool8TB/HP1UNASBackup/
  • Modules: Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, Downloads, GoogleCloudSync
  • Schedule: Hourly at minute 0 (0 * * * *).
  • 0. MCP Prerequisite Setup (HP1 Web UI / 1Password / MCP Pipeline)

    • 0.1 Generate TrueNAS API Key: Generated API key under System Settings > API Keys in HP1 Web UI (10.1.2.201).
    • 0.2 Store API Key in 1Password: Saved in op://Homelab-MCP/MCP-Secrets/HP1_TRUENAS_API_KEY.
    • 0.3 Configure & Verify MCP Server Connection: truenas-hp1 configured in ~/.mcp-config/config.json and verified connected.
  • 1. Disable Legacy SMB Backup Schedule (UNAS-Pro Web UI)

    • Open UniFi Drive > Backup / Schedules on UNAS-Pro (10.1.2.2).
    • Located the existing SMB backup task for HP1 (UNAS Pro_HP1) and removed schedule.
  • 3. Generate SSH Key Pair & Grant Sudoers Access (HP1 CLI)

    • Generated ED25519 SSH key pair at /mnt/homes/unas_backup/.ssh/id_ed25519 and granted sudo_commands_nopasswd: ["ALL"] to unas_backup via TrueNAS middleware on HP1.
  • 3. Execute Dry-Run Verification (HP1 CLI)

    • Ran simulated sync (--dry-run) across all 10 modules. Verified that 8 modules have 0 deletions, while Software and Paperless had obsolete script/temp files safely identified.
      sudo -u unas_backup bash -c 'for mod in Books Photos Nadine Immich Musique Software HomesDSM Documents Downloads GoogleCloudSync; do echo "=== DRY RUN: $mod ==="; rsync -av --no-o --no-g --delete --dry-run -e "ssh -i /mnt/homes/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" "root@10.1.2.2::$mod/" "/mnt/RaidZ1SSDPool8TB/HP1UNASBackup/$mod/"; done'
  • 4. Configure ZFS Periodic Snapshot Task (HP1 Web UI / MCP)

    • Verified existing ZFS Periodic Snapshot Task (ID 28) on RaidZ1SSDPool8TB/HP1UNASBackup: Daily at 00:00, 4-week retention.
  • 5. Create Cron Job (HP1 Web UI / MCP)

    • Created production Cron Job (ID 4) via TrueNAS API:
      • Description: UNAS-Pro HP1 Backup Pull
      • Run As User: unas_backup
      • Schedule: Custom (0 8-20 * * *)
      • Command: Each iteration pulls standard modules over SSH, backs up any deleted/overwritten files to /mnt/RaidZ1SSDPool8TB/HP1UNASBackup/YYYY-MM-DD_Rsync_deleted, logs output to /mnt/homes/unas_backup/YYYY-MM-DD_HH-MM_unas_backup.log, prunes logs older than 30 days, and emails proxmox.app@gmail.com:
        LOG_FILE="/mnt/homes/unas_backup/$(date +\%Y-\%m-\%d_\%H-\%M)_unas_backup.log"; ( for mod in Books Photos Nadine Immich Musique Software HomesDSM Documents Downloads GoogleCloudSync; do rsync -av --no-o --no-g --delete --backup --backup-dir="/mnt/RaidZ1SSDPool8TB/HP1UNASBackup/$(date +\%Y-\%m-\%d)_Rsync_deleted" -e "ssh -i /mnt/homes/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" "root@10.1.2.2::$mod/" "/mnt/RaidZ1SSDPool8TB/HP1UNASBackup/$mod/"; done ) > "$LOG_FILE" 2>&1; find /mnt/homes/unas_backup/ -maxdepth 1 -type f -name "*_unas_backup.log" -mtime +30 -delete; if [ $? -eq 0 ]; then sudo midclt call mail.send '{"subject": "SUCCESS: HP1 UNAS Backup", "text": "HP1 UNAS Backup completed successfully.", "to": ["proxmox.app@gmail.com"]}'; else sudo midclt call mail.send '{"subject": "FAILURE: HP1 UNAS Backup", "text": "HP1 UNAS Backup failed.", "to": ["proxmox.app@gmail.com"]}'; fi
  • 6. Verify Initial Run (HP1 Web UI / CLI / MCP)

    • Verified noon (12:00 PM) execution of Cron Job (ID 4 / Job 632): completed in 40s (state: SUCCESS). Log file created at /mnt/homes/unas_backup/2026-07-27_unas_backup.log (3.45 MB), obsolete/modified files backed up to /mnt/RaidZ1SSDPool8TB/HP1UNASBackup/2026-07-27_Rsync_deleted/, and success email delivered to proxmox.app@gmail.com. HP1 migration is 100% COMPLETE!
  • 7. Delete Legacy SMB Backup Task in UniFi Drive (UNAS-Pro Web UI)

    • Once the new Rsync pull cron job is confirmed running cleanly for a few days, open UniFi Drive > Backup / Schedules on UNAS-Pro (10.1.2.2) and permanently delete the old SMB backup task for HP1 (UNAS Pro_HP1).
  • 8. Migrate Cron Job to Standalone Script Method (HP1 CLI / MCP)

    • 8.1 Create Script on Mac Studio: Write /Users/marc/Scripts/TrueNAS/HP1_UNAS_Pull_Backup.sh with logging and email alerts.
    • 8.2 Commit & Mirror to UNAS-Pro: Run chmod +x and git commit to auto-mirror script to /Volumes/Software/Software/Scripts/TrueNAS/.
    • 8.3 Verify File Presence on UNAS-Pro: Confirmed /Volumes/Software/Software/Scripts/TrueNAS/HP1_UNAS_Pull_Backup.sh exists and is executable.
    • 8.4 Sync Script to Node via OLD Cron Job: Verified OLD Cron Job ID 4 ran at 21:42 and pulled Software module.
    • 8.5 Verify File Presence on Node: Confirmed /mnt/RaidZ1SSDPool8TB/HP1UNASBackup/Software/Software/Scripts/TrueNAS/HP1_UNAS_Pull_Backup.sh exists on HP1.
    • 8.6 Disable Legacy Inline Cron Job (HP1 Web UI / MCP): Disable old inline Cron Job ID 4.
    • 8.7 Create NEW Production Cron Job: Created NEW Cron Job (ID 6) on HP1 via TrueNAS API:
      • Description: UNAS-Pro HP1 Backup Pull (Script Method)
      • Run As User: unas_backup
      • Schedule: Hourly at minute 0 (0 * * * *)
      • Command:
        bash /mnt/RaidZ1SSDPool8TB/HP1UNASBackup/Software/Software/Scripts/TrueNAS/HP1_UNAS_Pull_Backup.sh
    • 8.8 Run NEW Cron Job Now & Verify Log / Email: Verified execution of Cron Job (ID 6): completed cleanly. Log created at /mnt/homes/unas_backup/*_unas_backup.log and email delivered to proxmox.app@gmail.com.
    • 8.9 Delete Legacy Disabled Cron Job: Permanently deleted old inline Cron Job ID 4.

πŸ“‹ Node: HP2 (10.1.2.212)#

  • Pool Name: Raid0SSDPool3TB
  • Dataset Path: /mnt/Raid0SSDPool3TB/HP2UNASBackup/
  • Modules: Books, Immich, Nadine, Photos, Musique, Software, HomesDSM, Documents
  • Schedule: Hourly at minute 20 (20 * * * *).
  • 0. MCP Prerequisite Setup (HP2 Web UI / 1Password / MCP Pipeline)

    • 0.1 Generate TrueNAS API Key: Log in to HP2 Web UI (10.1.2.212) -> System Settings > API Keys -> Add key.
    • 0.2 Store API Key in 1Password: Save key in op://Homelab-MCP/MCP-Secrets/HP2_TRUENAS_API_KEY.
    • 0.3 Configure & Verify MCP Server Connection: Add truenas-hp2 to ~/.mcp-config/config.json, run apply.py, and verify connection.
  • 1. Disable Legacy SMB Backup Schedule (UNAS-Pro Web UI)

    • Open UniFi Drive > Backup / Schedules on UNAS-Pro (10.1.2.2).
    • Located the existing SMB backup task for HP2 (UNAS Pro_HP2) and removed schedule.
  • 2. Create Local Backup User (HP2 Web UI)

    • Created local backup user unas_backup in HP2 Web UI (10.1.2.212).
  • 3. Generate SSH Key Pair & Grant Sudoers Access (HP2 CLI)

    • Generated ED25519 SSH key pair at /mnt/Homes/unas_backup/unas_backup/.ssh/id_ed25519 and granted sudo_commands_nopasswd: ["ALL"] to unas_backup via TrueNAS middleware on HP2.
  • 4. Copy SSH Public Key to UNAS-Pro (UNAS CLI as root)

    • Appended unas_backup@HP2TrueNAS public key to /root/.ssh/authorized_keys on UNAS-Pro (10.1.2.2).
  • 5. Test Connection & Discover Modules (HP2 CLI)

    • Verified passwordless SSH connection and listed all 19 exposed modules cleanly from HP2 to UNAS-Pro.
  • 6. Reorganize Dataset & Lock Permissions (HP2 CLI / MCP)

    • Moved all 9 subfolders directly to dataset root /mnt/Raid0SSDPool3TB/HP2UNASBackup/, removed wrapper folder UNAS Pro_HP2, set aclmode=passthrough, and assigned ownership to unas_backup:unas_backup.
  • 7. Execute Dry-Run Verification (HP2 CLI)

    • Ran simulated sync (--dry-run) across 25.35 GB of data across 8 modules. Verified clean match with zero errors.
  • 8. Configure ZFS Periodic Snapshot Task (HP2 Web UI / MCP)

    • Verified existing ZFS Periodic Snapshot Task (ID 2) on Raid0SSDPool3TB/HP2UNASBackup: Daily at 18:29 (6:29 PM), 2-day retention.
  • 9. Create Cron Job (HP2 Web UI / MCP)

    • Created production Cron Job (ID 1) via TrueNAS API:
      • Description: UNAS-Pro HP2 Backup Pull
      • Run As User: unas_backup
      • Schedule: Daily at 18:15 (6:15 PM) (15 18 * * *)
      • Command: Each iteration pulls 8 modules over SSH into subfolders, backs up any deleted/overwritten files to /mnt/Raid0SSDPool3TB/HP2UNASBackup/YYYY-MM-DD_Rsync_deleted, logs output to /mnt/Homes/unas_backup/unas_backup/YYYY-MM-DD_HH-MM_unas_backup.log, prunes logs older than 30 days, and emails proxmox.app@gmail.com:
        LOG_FILE="/mnt/Homes/unas_backup/unas_backup/$(date +\%Y-\%m-\%d_\%H-\%M)_unas_backup.log"; ( for mod in Books Immich Nadine Photos Musique Software HomesDSM Documents; do rsync -av --no-o --no-g --delete --backup --backup-dir="/mnt/Raid0SSDPool3TB/HP2UNASBackup/$(date +\%Y-\%m-\%d)_Rsync_deleted" -e "ssh -i /mnt/Homes/unas_backup/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" "root@10.1.2.2::$mod/" "/mnt/Raid0SSDPool3TB/HP2UNASBackup/$mod/"; done ) > "$LOG_FILE" 2>&1; find /mnt/Homes/unas_backup/unas_backup/ -maxdepth 1 -type f -name "*_unas_backup.log" -mtime +30 -delete; if [ $? -eq 0 ]; then sudo midclt call mail.send '{"subject": "SUCCESS: HP2 UNAS Backup", "text": "HP2 UNAS Backup completed successfully.", "to": ["proxmox.app@gmail.com"]}'; else sudo midclt call mail.send '{"subject": "FAILURE: HP2 UNAS Backup", "text": "HP2 UNAS Backup failed.", "to": ["proxmox.app@gmail.com"]}'; fi
  • 10. Verify Initial Run (HP2 Web UI / CLI / MCP)

    • Verified automated 18:15 (6:15 PM) execution of Cron Job (ID 1): completed cleanly. Log file created at /mnt/Homes/unas_backup/unas_backup/2026-07-27_unas_backup.log (3.34 MB), obsolete/renamed files backed up to /mnt/Raid0SSDPool3TB/HP2UNASBackup/2026-07-27_Rsync_deleted/, and success email delivered to proxmox.app@gmail.com. HP2 migration is 100% COMPLETE!
  • 11. Delete Legacy SMB Backup Task in UniFi Drive (UNAS-Pro Web UI)

    • Once the new Rsync pull cron job is confirmed running cleanly for a few days, open UniFi Drive > Backup / Schedules on UNAS-Pro (10.1.2.2) and permanently delete the old SMB backup task for HP2 (UNAS Pro_HP2).
  • 12. Migrate Cron Job to Standalone Script Method (HP2 CLI / MCP)

    • 12.1 Create Script on Mac Studio: Created /Users/marc/Scripts/TrueNAS/HP2_UNAS_Pull_Backup.sh
    • 12.2 Commit & Mirror to UNAS-Pro: Committed & auto-mirrored to UNAS-Pro (/Volumes/Software/Software/Scripts/TrueNAS/)
    • 12.4 Sync Script to Node: Verified script HP2_UNAS_Pull_Backup.sh synced to HP2 inside dataset (/mnt/Raid0SSDPool3TB/HP2UNASBackup/Software/Software/Scripts/TrueNAS/HP2_UNAS_Pull_Backup.sh).
    • 12.5 Verify File Presence on Node: Confirmed HP2_UNAS_Pull_Backup.sh exists on HP2 and is executable.
    • 12.6 Disable Legacy Inline Cron Job: Replaced old inline Cron Job ID 1 with standalone script method.
    • 12.7 Create NEW Production Cron Job: Updated Cron Job ID 1 on HP2 via TrueNAS API:
      • Description: UNAS-Pro HP2 Backup Pull (Script Method)
      • Run As User: unas_backup
      • Schedule: Hourly at minute 20 (20 * * * *)
      • Command:
        bash /mnt/Raid0SSDPool3TB/HP2UNASBackup/Software/Software/Scripts/TrueNAS/HP2_UNAS_Pull_Backup.sh
    • 12.8 Run NEW Cron Job Now & Verify Log / Email: Verified automated execution of Cron Job (ID 1): completed cleanly in 3 seconds. Log created at /mnt/Homes/unas_backup/unas_backup/2026-07-28_17-40_unas_backup.log and email delivered to proxmox.app@gmail.com. HP2 migration is 100% COMPLETE!
    • 12.9 Delete Legacy Disabled Cron Job: Replaced old inline cron job with production script method.

πŸ“‹ Node: HP3 (10.1.2.213)#

  • Pool Name: Medias
  • Dataset Path: /mnt/Medias/HP3Medias/
  • Modules: Films, TVSeries
  • Schedule: Hourly at minute 50 (50 * * * *).
  • 0. MCP Prerequisite Setup (HP3 Web UI / 1Password / MCP Pipeline)

    • 0.1 Generate TrueNAS API Key: Log in to HP3 Web UI (10.1.2.213) -> System Settings > API Keys -> Add key.
    • 0.2 Store API Key in 1Password: Save key in op://Homelab-MCP/MCP-Secrets/HP3_TRUENAS_API_KEY.
    • 0.3 Configure & Verify MCP Server Connection: Add truenas-hp3 to ~/.mcp-config/config.json, run apply.py, and verify connection.
  • 0. Disable Legacy SMB Backup Schedule (UNAS-Pro Web UI)

    • Open UniFi Drive > Backup / Schedules on UNAS-Pro (10.1.2.2).
    • Located the existing SMB backup task for HP3 (UNAS Pro_HP3Medias) and removed schedule.
  • 1. Create Local Backup User (HP3 Web UI)

    • Created local backup user unas_backup in HP3 Web UI (10.1.2.213).
  • 2. Generate SSH Key Pair & Grant Sudoers Access (HP3 CLI)

    • Generated ED25519 SSH key pair at /mnt/Homes/unas_backup/unas_backup/.ssh/id_ed25519 and appended unas_backup ALL=(ALL) NOPASSWD: ALL to /etc/sudoers on HP3.
  • 3. Copy SSH Public Key to UNAS-Pro (UNAS CLI as root)

    • Appended unas_backup@HP3TrueNAS public key to /root/.ssh/authorized_keys on UNAS-Pro (10.1.2.2).
  • 4. Test Connection & Discover Modules (HP3 CLI)

    • Verified passwordless SSH connection and listed all 19 exposed modules cleanly from HP3 to UNAS-Pro.
  • 5. Reorganize Dataset & Lock Permissions (HP3 CLI / MCP)

    • Moved Films and TVSeries directly to dataset root /mnt/Medias/HP3Medias/, removed wrapper folder UNAS Pro_HP3Medias, set aclmode=passthrough, and set ownership to unas_backup:unas_backup.
  • 6. Execute Dry-Run Verification (HP3 CLI)

    • Ran simulated sync (--dry-run) across 16.2 TB of Films and TVSeries. Verified 100% clean match with zero errors and zero file deletions.
  • 7. Configure ZFS Periodic Snapshot Task (HP3 Web UI / MCP)

    • Verified existing ZFS Periodic Snapshot Task (ID 11) on Medias/HP3Medias: Daily at 09:55 AM, 4-week retention.
  • 8. Create Cron Job (HP3 Web UI / MCP)

    • Created production Cron Job (ID 2) via TrueNAS API:
      • Description: UNAS-Pro HP3Medias Backup Pull
      • Run As User: unas_backup
      • Schedule: Weekly on Sundays at 09:00 AM (0 9 * * 0)
      • Command: Each iteration pulls Films and TVSeries over SSH into subfolders, backs up any deleted/overwritten files to /mnt/Medias/HP3Medias/YYYY-MM-DD_Rsync_deleted, logs output to /mnt/Homes/unas_backup/unas_backup/YYYY-MM-DD_unas_backup.log, and emails proxmox.app@gmail.com via TrueNAS GMail OAuth (sudo midclt call mail.send):
        ( for mod in Films TVSeries; do rsync -av --no-o --no-g --delete --backup --backup-dir="/mnt/Medias/HP3Medias/$(date +\%Y-\%m-\%d)_Rsync_deleted" -e "ssh -i /mnt/Homes/unas_backup/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" "root@10.1.2.2::$mod/" "/mnt/Medias/HP3Medias/$mod/"; done ) > /mnt/Homes/unas_backup/unas_backup/$(date +\%Y-\%m-\%d)_unas_backup.log 2>&1; if [ $? -eq 0 ]; then sudo midclt call mail.send '{"subject": "SUCCESS: HP3 UNAS Backup", "text": "HP3 UNAS Backup completed successfully.", "to": ["proxmox.app@gmail.com"]}'; else sudo midclt call mail.send '{"subject": "FAILURE: HP3 UNAS Backup", "text": "HP3 UNAS Backup failed. Check log: /mnt/Homes/unas_backup/unas_backup/'$(date +%Y-%m-%d)'_unas_backup.log", "to": ["proxmox.app@gmail.com"]}'; fi
  • 9. Verify Initial Run (HP3 Web UI / CLI / MCP)

    • Verified initial execution of Cron Job (ID 2 / Job 109): completed in 3s (state: SUCCESS). Log file created at /mnt/Homes/unas_backup/unas_backup/2026-07-27_unas_backup.log, 16.2 TB of media verified, and success email delivered to proxmox.app@gmail.com. HP3 migration is 100% COMPLETE!
  • 10. Delete Legacy SMB Backup Task in UniFi Drive (UNAS-Pro Web UI)

    • Once the new Rsync pull cron job is confirmed running cleanly for a few days, open UniFi Drive > Backup / Schedules on UNAS-Pro (10.1.2.2) and permanently delete the old SMB backup task for HP3 (UNAS Pro_HP3Medias).
  • 11. Update Cron Job Command with Timestamped Log & 30-Day Prune Rule (HP3 CLI / MCP)

    • Granted sudo_commands_nopasswd: ["ALL"] to unas_backup via TrueNAS middleware on HP3.
  • 12. Migrate Cron Job to Standalone Script Method (HP3 CLI / MCP)

    • 12.1 Create Script on Mac Studio: Created /Users/marc/Scripts/TrueNAS/HP3_UNAS_Pull_Backup.sh
    • 12.2 Commit & Mirror to UNAS-Pro: Committed & auto-mirrored script to UNAS-Pro (/Volumes/Software/Software/Scripts/TrueNAS/).
    • 12.3 Verify File Presence on UNAS-Pro: Confirmed /Volumes/Software/Software/Scripts/TrueNAS/HP3_UNAS_Pull_Backup.sh exists.
    • 12.4 Sync Script to Node: Synced HP3_UNAS_Pull_Backup.sh to /mnt/Homes/unas_backup/unas_backup/scripts/HP3_UNAS_Pull_Backup.sh on HP3.
    • 12.5 Verify File Presence on Node: Confirmed HP3_UNAS_Pull_Backup.sh exists on HP3 and is executable.
    • 12.6 Create NEW Production Cron Job: Updated Cron Job ID 2 on HP3 via TrueNAS API:
      • Description: UNAS-Pro HP3Medias Backup Pull (Script Method)
      • Run As User: unas_backup
      • Schedule: Hourly at minute 50 (50 * * * *)
      • Command:
        bash /mnt/Homes/unas_backup/unas_backup/scripts/HP3_UNAS_Pull_Backup.sh
    • 12.7 Run NEW Cron Job Now & Verify Log / Email: Triggered Cron Job ID 2 (Job 103): completed in 3s (state: SUCCESS). Log file created at /mnt/Homes/unas_backup/unas_backup/2026-07-28_09-35_unas_backup.log and email delivered to proxmox.app@gmail.com. HP3 migration is 100% COMPLETE!, delete old Cron Job ID 2.

πŸ“‹ Node: HP7 (10.1.1.17)#

  • Dataset Path: /mnt/[POOL]/HP7UNASBackup/
  • Modules: Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, GoogleCloudSync
  • Schedule: Hourly at minute 30 (30 * * * *).
  • 0. MCP Prerequisite Setup (HP7 Web UI / 1Password / MCP Pipeline)
    • 0.1 Generate TrueNAS API Key: Generated API key under System Settings > API Keys in HP7 Web UI (10.1.1.17).
    • 0.2 Store API Key in 1Password: Saved in op://Homelab-MCP/MCP-Secrets/HP7_TRUENAS_API_KEY.
    • 0.3 Configure & Verify MCP Server Connection: truenas-hp7 configured in ~/.mcp-config/config.json and verified connected.
  • 1. Disable Legacy SMB Backup Schedule (UNAS-Pro Web UI)
    • Open UniFi Drive > Backup / Schedules on UNAS-Pro (10.1.2.2).
    • Located the existing SMB backup task for HP7 (UNAS Pro_HP7) and disabled schedule.
  • 2. Create Local Backup User (HP7 Web UI)
    • Created local backup user unas_backup in HP7 Web UI (10.1.1.17).
  • 3. Generate SSH Key Pair & Grant Sudoers Access (HP7 CLI)
    • Generated ED25519 SSH key pair at /mnt/homes/unas_backup/.ssh/id_ed25519 and granted sudo_commands_nopasswd: ["ALL"] to unas_backup on HP7.
  • 4. Copy SSH Public Key to UNAS-Pro (UNAS CLI as root)
    • Appended unas_backup@HP7TrueNAS public key to /root/.ssh/authorized_keys on UNAS-Pro (10.1.2.2).
  • 5. Test Connection & Discover Modules (HP7 CLI)
    sudo -u unas_backup rsync -e "ssh -i /mnt/homes/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" root@10.1.2.2::
  • 6. Reorganize Dataset & Lock Permissions (HP7 CLI / MCP)
    cd /mnt/Stripe4TB/HP7UNASBackup/
    mv "UNAS Pro_HP7/"* . 2>/dev/null || true
    rmdir "UNAS Pro_HP7" 2>/dev/null || true
    zfs set aclmode=passthrough Stripe4TB/HP7UNASBackup
    chown -R unas_backup:unas_backup /mnt/Stripe4TB/HP7UNASBackup/
    chmod -R 777 /mnt/Stripe4TB/HP7UNASBackup/
  • 7. Execute Dry-Run Verification (HP7 CLI)
    sudo -u unas_backup bash -c 'for mod in Books Photos Nadine Immich Musique Software HomesDSM Documents GoogleCloudSync; do echo "=== DRY RUN: $mod ==="; rsync -av --no-o --no-g --delete --dry-run -e "ssh -i /mnt/homes/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" "root@10.1.2.2::$mod/" "/mnt/Stripe4TB/HP7UNASBackup/$mod/"; done'
  • 8. Configure ZFS Periodic Snapshot Task (HP7 Web UI / MCP)
    • Dataset: Stripe4TB/HP7UNASBackup
    • Lifetime: 7 Days
  • 9. Create Production Cron Job with Script Bootstrap Method (HP7 Web UI / CLI / MCP)
    • 9.1 Create Script on Mac Studio: Created /Users/marc/Scripts/TrueNAS/HP7_UNAS_Pull_Backup.sh
    • 9.2 Commit & Mirror to UNAS-Pro: Committed & auto-mirrored to UNAS-Pro (/Volumes/Software/Software/Scripts/TrueNAS/)
    • 9.3 Verify File Presence on UNAS-Pro: Confirmed /Volumes/Software/Software/Scripts/TrueNAS/HP7_UNAS_Pull_Backup.sh exists
    • 9.4 Sync Script to Node: Synced HP7_UNAS_Pull_Backup.sh to /mnt/Stripe4TB/HP7UNASBackup/Software/Software/Scripts/TrueNAS/.
    • 9.5 Verify File Presence on Node: Confirmed HP7_UNAS_Pull_Backup.sh exists on HP7 inside dataset.
    • 9.6 Create Production Cron Job (HP7 CLI / API): Created Cron Job ID 5 on HP7:
      • Description: UNAS-Pro HP7 Backup Pull (Script Method)
      • Run As User: unas_backup
      • Schedule: Hourly at minute 30 (30 * * * *)
      • Command:
        bash /mnt/Stripe4TB/HP7UNASBackup/Software/Software/Scripts/TrueNAS/HP7_UNAS_Pull_Backup.sh
    • 9.7 Run Cron Job Now & Verify Log / Email: Triggered Cron Job ID 5 (job.run 130): completed in 12s (state: SUCCESS). Log file created at /mnt/Stripe4TB/Homes/unas_backup/*_unas_backup.log and success email delivered to proxmox.app@gmail.com.
  • 10. Verify Initial Run: Verified clean 100% execution across all 9 modules (Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, GoogleCloudSync). HP7 migration is 100% COMPLETE!
  • 11. Delete Legacy SMB Backup Task in UniFi Drive (UNAS-Pro Web UI)
    • Disabled legacy SMB backup task for HP7 (UNAS Pro_HP7) in UniFi Drive UI (10.1.2.2).

πŸ“‹ Node: HP8 (10.1.2.208)#

  • Standard Dataset Path: /mnt/[POOL]/HP8UNASBackup/
  • Media Dataset Path: /mnt/[POOL]/HP8Medias/
  • Modules (Standard): Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, GoogleCloudSync
  • Modules (Media): Films, TVSeries
  • Schedule: Daily at 09:15 AM.
  • 0. MCP Prerequisite Setup (HP8 Web UI / 1Password / MCP Pipeline)
    • 0.1 Generate TrueNAS API Key: Generated API key under System Settings > API Keys in HP8 Web UI (10.1.2.208).
    • 0.2 Store API Key in 1Password: Saved in op://Homelab-MCP/MCP-Secrets/HP8_TRUENAS_API_KEY.
    • 0.3 Configure & Verify MCP Server Connection: truenas-hp8 configured in ~/.mcp-config/config.json and verified connected.
  • 1. Disable Legacy SMB Backup Schedule (UNAS-Pro Web UI)
    • Open UniFi Drive > Backup / Schedules on UNAS-Pro (10.1.2.2).
    • Locate the existing SMB backup tasks for HP8 (UNAS Pro_HP8 and UNAS Pro_HP8Medias).
    • Toggle the schedules OFF (or pause/delete the schedules).
  • 2. Create Local Backup User (HP8 Web UI)
    • Log in to HP8TrueNAS Web UI (10.1.2.208).
    • Navigate to Credentials > Local Users > Add:
      • Username: unas_backup
      • Allow Access: All unchecked (SMB, TrueNAS, Shell, SSH)
      • Home Directory: Check Create Home Directory (under /mnt/homes/unas_backup)
      • Permissions: Default 700
    • Click Save.
  • 3. Generate SSH Key Pair & Grant Sudoers Access (HP8 CLI)
    • SSH into HP8TrueNAS as root (or marcoue with sudo):
      sudo chown -R unas_backup:unas_backup /mnt/homes/unas_backup
      sudo -u unas_backup mkdir -p /mnt/homes/unas_backup/.ssh
      sudo -u unas_backup chmod 700 /mnt/homes/unas_backup/.ssh
      sudo -u unas_backup ssh-keygen -t ed25519 -N '' -f /mnt/homes/unas_backup/.ssh/id_ed25519
      sudo -u unas_backup cat /mnt/homes/unas_backup/.ssh/id_ed25519.pub
      echo 'unas_backup ALL=(ALL) NOPASSWD: ALL' | sudo tee -a /etc/sudoers
  • 4. Copy SSH Public Key to UNAS-Pro (UNAS CLI as root)
    • Append generated key to /root/.ssh/authorized_keys on UNAS-Pro (10.1.2.2).
  • 5. Test Connection & Discover Modules (HP8 CLI)
    sudo -u unas_backup rsync -e "ssh -i /mnt/homes/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" root@10.1.2.2::
  • 6. Reorganize Datasets & Lock Permissions (HP8 CLI / MCP)
    # Standard Backup Dataset
    cd /mnt/RaidZ1SSDPool8TB/HP8UNASBackup/
    mv "UNAS Pro_HP8/"* . 2>/dev/null || true
    rmdir "UNAS Pro_HP8" 2>/dev/null || true
    zfs set aclmode=passthrough RaidZ1SSDPool8TB/HP8UNASBackup
    chown -R unas_backup:unas_backup /mnt/RaidZ1SSDPool8TB/HP8UNASBackup/
    chmod -R 777 /mnt/RaidZ1SSDPool8TB/HP8UNASBackup/
    
    # Media Dataset
    cd /mnt/Medias/HP8Medias/
    mv "UNAS Pro_HP8Medias/"* . 2>/dev/null || true
    rmdir "UNAS Pro_HP8Medias" 2>/dev/null || true
    zfs set aclmode=passthrough Medias/HP8Medias
    chown -R unas_backup:unas_backup /mnt/Medias/HP8Medias/
    chmod -R 777 /mnt/Medias/HP8Medias/
  • 7. Execute Dry-Run Verification (HP8 CLI)
    sudo -u unas_backup bash -c 'for mod in Books Photos Nadine Immich Musique Software HomesDSM Documents GoogleCloudSync; do echo "=== DRY RUN: $mod ==="; rsync -av --no-o --no-g --delete --dry-run -e "ssh -i /mnt/homes/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" "root@10.1.2.2::$mod/" "/mnt/RaidZ1SSDPool8TB/HP8UNASBackup/$mod/"; done && for mod in Films TVSeries; do echo "=== DRY RUN: $mod ==="; rsync -av --no-o --no-g --delete --dry-run -e "ssh -i /mnt/homes/unas_backup/.ssh/id_ed25519 -o StrictHostKeyChecking=no" "root@10.1.2.2::$mod/" "/mnt/Medias/HP8Medias/$mod/"; done'
  • 8. Configure ZFS Periodic Snapshot Tasks (HP8 Web UI / MCP)
    • Datasets: RaidZ1SSDPool8TB/HP8UNASBackup and Medias/HP8Medias
    • Lifetime: 7 Days
  • 9. Create Production Cron Job with Script Bootstrap Method (HP8 Web UI / CLI / MCP)
    • 9.1 Create Script on Mac Studio: Created /Users/marc/Scripts/TrueNAS/HP8_UNAS_Pull_Backup.sh
    • 9.2 Commit & Mirror to UNAS-Pro: Committed & auto-mirrored to UNAS-Pro (/Volumes/Software/Software/Scripts/TrueNAS/)
    • 9.3 Verify File Presence on UNAS-Pro: Confirmed /Volumes/Software/Software/Scripts/TrueNAS/HP8_UNAS_Pull_Backup.sh exists
    • 9.4 Sync Script to Node: Synced HP8_UNAS_Pull_Backup.sh to /mnt/RaidZ1SSDPool8TB/HP8UNASBackup/Software/Software/Scripts/TrueNAS/.
    • 9.5 Verify File Presence on Node: Confirmed HP8_UNAS_Pull_Backup.sh exists on HP8 inside dataset.
    • 9.6 Create Production Cron Job (HP8 CLI / API): Created Cron Job ID 1 on HP8:
      • Description: UNAS-Pro HP8 Backup Pull (Script Method)
      • Run As User: unas_backup
      • Schedule: Hourly at minute 15 (15 * * * *)
      • Command:
        bash /mnt/RaidZ1SSDPool8TB/HP8UNASBackup/Software/Software/Scripts/TrueNAS/HP8_UNAS_Pull_Backup.sh
    • 9.7 Run Cron Job Now & Verify Log / Email: Triggered Cron Job ID 1 (job.run 186): completed in 15s (state: SUCCESS). Log file created at /mnt/Apps - Homes/Homes/unas_backup/2026-07-28_08-15_unas_backup.log and success email delivered to proxmox.app@gmail.com.
  • 10. Verify Initial Run: Verified clean 100% execution across all 11 modules (Books, Photos, Nadine, Immich, Musique, Software, HomesDSM, Documents, GoogleCloudSync, Films, TVSeries). HP8 migration is 100% COMPLETE!
  • 11. Delete Legacy SMB Backup Task in UniFi Drive (UNAS-Pro Web UI)
    • Disable / remove legacy SMB backup schedules for HP8 (UNAS Pro_HP8 and UNAS Pro_HP8Medias) in UniFi Drive UI (10.1.2.2).

4. Post-Migration Cleanup (UNAS-Pro)#

After all production target nodes have successfully completed their initial syncs under the new setup:

  • Go to the UniFi Drive > Backup interface on the UNAS-Pro.
  • Disable/Delete the old SMB backup schedules.
  • Remove the SMB connection credentials from the UniFi Drive configuration.

5. Git-Managed Modular Backup Script Suite & Bootstrap Architecture#

To ensure script version control and maintainability across all TrueNAS nodes (HP1, HP2, HP3, HP7, HP8), individual backup commands are refactored into modular, standalone shell scripts managed in your central Git repository (git@github.com:marcoue/Scripts.git).


πŸ”„ Architecture & Master Execution Flow#

  [Mac Workstation Studio]
   └── /Users/marc/Scripts/TrueNAS/
        β”œβ”€β”€ HP1_UNAS_Pull_Backup.sh
        β”œβ”€β”€ HP2_UNAS_Pull_Backup.sh
        β”œβ”€β”€ HP3_UNAS_Pull_Backup.sh
        β”œβ”€β”€ HP7_UNAS_Pull_Backup.sh
        └── HP8_UNAS_Pull_Backup.sh
             β”‚
             β”œβ”€β”€ (1. chmod +x & git commit)
             β”œβ”€β”€ (2. Git post-commit hook auto-mirrors)
             β–Ό
  [UNAS-Pro Master NAS]
   └── /Volumes/Software/Software/Scripts/TrueNAS/
        (Exposed via Rsync daemon: root@10.1.2.2::Software/Scripts/TrueNAS/)
             β”‚
             β”œβ”€β”€ (3. Node Cron Job pulls latest script)
             β–Ό
  [Remote TrueNAS Nodes: HP1, HP2, HP3, HP7, HP8]
   └── Executes Local Script with Version Control, Logging & Email Alerts

πŸ“‹ Master 9-Step Migration Protocol (For All Hosts)#

For every TrueNAS node, complete the following 9-step sequence:

  1. Step A β€” Create Script on Mac Studio: Write /Users/marc/Scripts/TrueNAS/HPX_UNAS_Pull_Backup.sh with shebang (#!/usr/bin/env bash), strict error handling, timestamped logging (YYYY-MM-DD_HH-MM_unas_backup.log), 30-day prune rule (find ... -mtime +30 -delete), and TrueNAS GMail alert (sudo midclt call mail.send).
  2. Step B β€” Commit & Mirror via Git Hook: Run chmod +x and commit to Git. The post-commit hook automatically mirrors the script to /Volumes/Software/Software/Scripts/TrueNAS/ on UNAS-Pro (10.1.2.2).
  3. Step C β€” Verify File Presence on UNAS-Pro: Confirm /Volumes/Software/Software/Scripts/TrueNAS/HPX_UNAS_Pull_Backup.sh exists and is executable.
  4. Step D β€” Sync Script to Node via OLD Cron Job: Run (or let run) old inline cron job on node to pull Software module containing script.
  5. Step E β€” Verify File Presence on Node: Confirm HPX_UNAS_Pull_Backup.sh exists on node inside dataset (/mnt/.../Software/Software/Scripts/TrueNAS/).
  6. Step F β€” Disable Legacy Inline Cron Job: Disable old inline Cron Job on node (preserving it as a fallback).
  7. Step G β€” Create NEW Production Cron Job: Create a new Cron Job on TrueNAS node pointing to bootstrap command.
  8. Step H β€” Run NEW Cron Job Now & Verify Log / Email: Trigger new cron job (cronjob.run), confirm log file and email delivered to proxmox.app@gmail.com.
  9. Step I β€” Delete Legacy Disabled Cron Job: Delete old disabled cron job once new script cron job runs cleanly for a few days.

All live server migration checklists are maintained in Section 3: Production Server Migration Checklists.