diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 01419b6..a6558f4 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -48,9 +48,23 @@ "icon": "lucide-file", "title": "OpenZFS" } + }, + { + "id": "5835d37332be098c", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "_Inbox/2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup" + } } ], - "currentTab": 2 + "currentTab": 3 } ], "direction": "vertical" @@ -124,7 +138,7 @@ "state": { "type": "backlink", "state": { - "file": "_Inbox/OpenZFS.md", + "file": "_Inbox/2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup.md", "collapseAll": true, "extraContext": false, "sortOrder": "alphabeticalReverse", @@ -134,7 +148,7 @@ "unlinkedCollapsed": true }, "icon": "links-coming-in", - "title": "Backlinks for OpenZFS" + "title": "Backlinks for 2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup" } }, { @@ -143,12 +157,12 @@ "state": { "type": "outgoing-link", "state": { - "file": "_Inbox/OpenZFS.md", + "file": "_Inbox/2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup.md", "linksCollapsed": false, "unlinkedCollapsed": false }, "icon": "links-going-out", - "title": "Outgoing links from OpenZFS" + "title": "Outgoing links from 2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup" } }, { @@ -211,10 +225,10 @@ "state": { "type": "file-properties", "state": { - "file": "_Inbox/OpenZFS.md" + "file": "_Inbox/2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup.md" }, "icon": "lucide-info", - "title": "File properties for OpenZFS" + "title": "File properties for 2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup" } }, { @@ -265,8 +279,11 @@ "tasknotes:Open Pomodoro statistics": false } }, - "active": "c8808af5e051fd18", + "active": "5835d37332be098c", "lastOpenFiles": [ + "_Inbox/TrueNAS.md", + "_Inbox/2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup.md", + "_Inbox/OpenZFS.md", "_Inbox/Elixir M2U51264DS8HB3G-5T 512MB DDR-400 RAM.md", "_Inbox/TwinMOS MDSHXLF08I08H244AZEW-T 256MB SDRAM.md", "_Inbox/2026-05-17 0906 old RAM haul.md", @@ -279,7 +296,6 @@ "_Inbox/Kingston ValueRAM KVR333X64C25-512 512MB DDR RAM.md", "_Inbox/Kingston KVR800D2N5-2G 2GB PC2-6400 DDR2 RAM (B8F).md", "_Inbox/Kingston KVR800D2N5-2G 2GB PC2-6400 DDR2 RAM (9X6).md", - "_Inbox/OpenZFS.md", "Kingston KVR800D2N5/2G 2GB PC2 RAM.md", "Kingston KVR800D2N5", "_Inbox/Docker.md", @@ -293,8 +309,6 @@ "_Inbox/neurodivergent insights.md", "_Inbox/2026-03-21 When Autism Hides the ADHD - 6 Ways It Gets Missed.md", "Categories/Library.md", - "Daily Notes/2026-05-17.md", - "References/Gigabyte Brix GB-BXBT-2807 PC.md", "Attachments/Invoice PPSI137523 From Bargain Hardware.pdf", "Attachments/ThinkStation_P520_Spec.pdf", "Attachments/p520_p520c_power_configurator_v1.6.pdf", diff --git a/_Inbox/2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup.md b/_Inbox/2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup.md new file mode 100644 index 0000000..a7e3c23 --- /dev/null +++ b/_Inbox/2026-05-17 1129 migrating to truenas, sanoid+syncoid config and script backup.md @@ -0,0 +1,238 @@ +--- +category: + - "[[Journal]]" +type: + - "[[Log]]" +title: migrating to truenas, sanoid+syncoid backup +created: 2026-05-17T11:29:26 +date: 2026-05-17 +tags: +--- +So I'm going to try running [[TrueNAS|truenas]] on my backup machine rather than [[Proxmox|proxmox]] with [[Sanoid and Syncoid|sandoid+synoid]]. + +here are my current config and scripts on the +`/etc/sanoid/sanoid.conf` +``` +######################## + +# stanleypool datasets # + +######################## + + + +[stanleypool/archive] + +    use_template = stanleypool-nightly + +    recursive = zfs + +    process_children_only = no + + + +[stanleypool/bobbie] + +    use_template = stanleypool-nightly + +    recursive = zfs + +    process_children_only = no + + + +[stanleypool/music] + +    use_template = stanleypool-nightly + +    recursive = zfs + +    process_children_only = no + + + +[stanleypool/photos] + +    use_template = stanleypool-nightly + +    recursive = zfs + +    process_children_only = no + + + +[stanleypool/video] + +    use_template = stanleypool-nightly + +    recursive = zfs + +    process_children_only = no + + + +############# + +# templates # + +############# + + + +[template_stanleypool-nightly] + +    frequently = 0 + +    hourly = 0 + +    daily = 90 + +    weekly = 26 + +    monthly = 24 + +    yearly = 0 + +    autosnap = no + +    autoprune = yes + +    prune_defer = 80 +``` + +`/usr/local/bin/zfs-nightly-backup.sh` +``` +#!/bin/bash + +GLOBAL_TIMEOUT="6h" + +# --- CRASH SAFETY NET --- + +# If the script exits prematurely for ANY reason, run the shutdown function + +failure_cleanup() { + +    echo "$(date '+[%Y-%m-%d %H:%M:%S]') CRITICAL: Script terminated unexpectedly! Triggering safety shutdown." + +    ssh root@pve-shug9 "/sbin/shutdown +10 'Nightly backup crashed, shutting down in 10 minutes'" + +    /sbin/shutdown +10 "Nightly backup crashed, shutting down in 10 minutes" + +} + +# Trap standard exit signals (1 = General errors, 2 = Ctrl+C, 15 = Terminate) + +trap 'if [ "$EXIT_STATUS" != "0" ] && [ "$EXIT_STATUS" != "124" ]; then failure_cleanup; fi' EXIT + + + +run_backups() { + +    # pull existing snapshots from source (thinkstation) + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=pull --preserve-recordsize --preserve-properties root@pve-thinkstation:noggapool/bobbie stanleypool/bobbie + +    sleep 10 + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=pull --preserve-recordsize --preserve-properties root@pve-thinkstation:noggapool/photos stanleypool/photos + +    sleep 10 + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=pull --preserve-recordsize --preserve-properties root@pve-thinkstation:noggapool/archive stanleypool/archive + +    sleep 10 + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=pull --preserve-recordsize --preserve-properties root@pve-thinkstation:noggapool/music stanleypool/music + +    sleep 10 + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=pull --preserve-recordsize --preserve-properties root@pve-thinkstation:noggapool/video stanleypool/video + +    sleep 10 + + + +    # push to remote (shug9) + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=push --preserve-recordsize --preserve-properties root@pve-shug9:bathpool/bobbie stanleypool/bobbie + +    sleep 10 + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=push --preserve-recordsize --preserve-properties stanleypool/photos root@pve-shug9:bathpool/photos + +    sleep 10 + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=push --preserve-recordsize --preserve-properties stanleypool/archive root@pve-shug9:bathpool/archive + +    sleep 10 + +    /usr/sbin/syncoid --quiet -r --no-sync-snap --create-bookmark --use-hold --identifier=push --preserve-recordsize --preserve-properties stanleypool/music root@pve-shug9:bathpool/music + +    sleep 10 + + + +    # only run the prune after successful transfers + +    ssh root@pve-shug9 "/usr/sbin/sanoid --quiet --prune-snapshots" + +    sleep 5 + +    /usr/sbin/sanoid --quiet --prune-snapshots + +    sleep 5 + +    echo "Backup script completed successfully." + +} + + + +# Export the function so the timeout subshell can see it + +export -f run_backups + + + +# Run the function wrapped in the timeout utility + +timeout "$GLOBAL_TIMEOUT" bash -c run_backups + +EXIT_STATUS=$? + + + +# --- EVALUATE EXIT STATE FOR LOGGING --- + + + +if [ $EXIT_STATUS -eq 124 ]; then + +    echo "$(date '+[%Y-%m-%d %H:%M:%S]') ERROR: Script exceeded global timeout of $GLOBAL_TIMEOUT. Aborting." + +elif [ $EXIT_STATUS -ne 0 ]; then + +    echo "$(date '+[%Y-%m-%d %H:%M:%S]') ERROR: Backup function failed with exit code $EXIT_STATUS." + +else + +    echo "$(date '+[%Y-%m-%d %H:%M:%S]') Success: All replication steps completed." + +fi + + + +# --- UNCONDITIONAL 10-MINUTE DELAYED SHUTDOWN --- + +# This runs normally for Success or Timeout states. + +# (General script crashes bypass this and hit the 'trap' function at the top). + +ssh root@pve-shug9 "/sbin/shutdown +10 'Nightly backup/replication sequence finished, shutting down in 10 minutes'" + +/sbin/shutdown +10 "Nightly backup/replication sequence finished, shutting down in 10 minutes" + + + +exit $EXIT_STATUS +``` \ No newline at end of file diff --git a/_Inbox/TrueNAS.md b/_Inbox/TrueNAS.md new file mode 100644 index 0000000..4d37e90 --- /dev/null +++ b/_Inbox/TrueNAS.md @@ -0,0 +1,7 @@ +--- +created: 2026-05-17T11:40:36 +category: + - "[[Software]]" +os: "[[Hypervisor]]" +url: +---