Files
Varaverk/Rsync/README-Rsync_Setup.md
T

6.9 KiB
Raw Blame History

This guide is a work in progress and generated by ai, dont have time for guides. so this works

Rsync Setup Guide

Status: Work in Progress For the unRAID Rsync Ecosystem — common.sh · Master.conf · rsync.sh · daily_sync.sh

Overview

This guide walks through setting up the rsync ecosystem on both your primary and secondary unRAID 7.x servers. By the end you will have:

SSH keys configured for server-to-server communication Tailscale running on both servers for secure networking Scripts scheduled and running via the User Scripts plugin Automated daily sync of media shares and appdata profiles Prerequisites

Both servers need the following before starting:

unRAID 7.x User Scripts plugin installed via Community Applications Tailscale plugin installed via Community Applications Terminal access to both servers (via unRAID UI → Tools → Terminal, or SSH) Step 1 — Tailscale Setup

Tailscale provides the secure network tunnel between your two servers. The scripts resolve the remote server's IP via Tailscale at runtime.

On Both Servers

Open Apps in the unRAID UI Search for Tailscale and install the plugin Once installed, go to Settings → Tailscale Click Connect and authenticate with your Tailscale account Verify both servers appear in your Tailscale admin console

Verify Connectivity

Run this on the primary to confirm it can see the secondary:

tailscale ip -4 unRAID-Jayred365

You should get back a 100.x.x.x IP. If not, check both servers in the Tailscale admin console.

Note: The hostnames used in Master.conf (HOST1 and HOST2) must match the Tailscale machine names exactly — these are case sensitive.

Step 2 — Generate SSH Keys (Server-to-Server)

The scripts use SSH keys for server-to-server rsync.

On Primary (unRAID-Gmer4Lfe):

ssh-keygen -t ed25519 -f /root/.ssh/Gmer4Lfe-rsync-key -C "gmer4lfe-rsync" -N ""

On Secondary (unRAID-Jayred365):

ssh-keygen -t ed25519 -f /root/.ssh/Jayred365-rsync-key -C "jayred365-rsync" -N "" Copy Public Keys to Each Server

Primary → Secondary

On primary

cat /root/.ssh/Gmer4Lfe-rsync-key.pub

Copy the output. Then on secondary:

mkdir -p /root/.ssh echo "PASTE_PUBLIC_KEY_HERE" >> /root/.ssh/authorized_keys chmod 600 /root/.ssh/authorized_keys

Secondary → Primary

On secondary

cat /root/.ssh/Jayred365-rsync-key.pub

Copy the output. Then on primary:

mkdir -p /root/.ssh echo "PASTE_PUBLIC_KEY_HERE" >> /root/.ssh/authorized_keys chmod 600 /root/.ssh/authorized_keys Test the Connection

From the primary, test SSH access to the secondary:

ssh -i /root/.ssh/Gmer4Lfe-rsync-key root@$(tailscale ip -4 unRAID-Jayred365) "echo connected"

You should see connected. If prompted for a password, recheck the key authorization.

Step 3 — Enable SSH on unRAID

unRAID 7.x has SSH disabled by default. Enable it on both servers so the scripts can connect:

Go to Settings → Management Access Under Secure Shell, set SSH to Enabled Set SSH port to 22 (default) Click Apply

Security note: SSH is only exposed on your local network and Tailscale interface. The rsync scripts connect via Tailscale IP, so traffic is encrypted end-to-end.

Step 4 — Configure Master.conf

All user configuration lives in Master.conf. Open it and adjust the following to match your setup:

nano /mnt/user/appdata/unraid_scripts/Master.conf

Required Changes:

Variable Description Example HOST1 Hostname of your primary server unRAID-Gmer4Lfe HOST2 Hostname of your secondary server unRAID-Jayred365 HOST1_SSH_KEY Path to primary's rsync private key /root/.ssh/Gmer4Lfe-rsync-key HOST2_SSH_KEY Path to secondary's rsync private key /root/.ssh/Jayred365-rsync-key BW_LIMIT Global bandwidth limit in KB/s 12500 ROOTFS_WARN Remote rootfs % threshold before aborting 75

Daily Sync Shares

Add the full paths of all media shares you want synced nightly:

DAILY_SYNC_SHARES=( /mnt/user/Movies /mnt/user/Tv_Shows /mnt/user/Music # add more here )

Profiles

Profiles control per-share rsync behaviour for your frequently synced appdata shares.

declare -A PROFILE_CRITICAL_CONTAINER_NAMES=( [arrs_stack]="Sonarr Radarr Lidarr Prowlarr" [important-data]="Postgres-NextCloud NextCloud" )

Any share with no matching profile falls through to the global DEFAULT_RSYNC_OPTS.

Step 5 — Set Up User Scripts

The User Scripts plugin schedules and runs the scripts. Each sync job is its own script entry.

Frequent Sync Jobs

Create one script entry per appdata profile (Plugins → User Scripts → Add New Script) Example for ARR stack: #!/bin/bash bash /mnt/user/appdata/unraid_scripts/Rsync/rsync.sh /mnt/user/appdata-Failover/Arrs_Stack

Daily Sync Orchestrator

#!/bin/bash bash /mnt/user/appdata/unraid_scripts/Orchestrators/daily_sync.sh Schedule daily at 01:00 Set scripts to run as Background Tasks Step 6 — Verify the Setup

Manually test from the primary:

bash /mnt/user/appdata/unraid_scripts/Rsync/rsync.sh /mnt/user/appdata-Failover/Arrs_Stack --log

You should see a healthy run with:

━━━ ⚙️ Setup ━━━ [INFO] 🖥️ Host: unRAID-Gmer4Lfe → unRAID-Jayred365 [INFO] 🌐 Remote IP: 100.x.x.x ... [OK] All disks backing share are online Step 7 — Secondary Server Initial Setup

If setting up secondary from scratch:

Complete Steps 15 on the secondary Start the array and create your shares in the unRAID UI Run the share recreation tool: bash /mnt/user/appdata/unraid_scripts/Tools/recreate_shares.sh Temporarily remove --delete from DEFAULT_RSYNC_OPTS for initial push Restore --delete after the first run; next nightly run will clean .recovery files automatically Troubleshooting

SSH connection refused

Verify SSH is enabled on target server (Step 3) Check correct key referenced in Master.conf Confirm Tailscale IP resolves

Pre-flight aborts

Rootfs above ROOTFS_WARN Share exists but empty Disk offline

Script not found

Verify scripts exist in /mnt/user/appdata/unraid_scripts/ Make scripts executable: chmod +x /mnt/user/appdata/unraid_scripts/Rsync/rsync.sh chmod +x /mnt/user/appdata/unraid_scripts/Orchestrators/daily_sync.sh chmod +x /mnt/user/appdata/unraid_scripts/Tools/recreate_shares.sh Available Flags Flag Description --dry-run or -n Run without making changes --log Enable verbose logging --no-log Disable logging --status Print resolved configuration and exit

Examples

Preview what would be synced without transferring

bash rsync.sh /mnt/user/Movies --dry-run --log

Check profile and settings resolved for a share

bash rsync.sh /mnt/user/appdata-Failover/Arrs_Stack --status Repository Structure Unraid_Scripts/ ├── Master.conf # All user configuration — edit this file only ├── common.sh # Shared library — functions used by all scripts ├── Rsync/ │ └── rsync.sh # Core rsync script — called per share ├── Orchestrators/ │ └── daily_sync.sh # Daily media sync orchestrator └── Tools/ └── recreate_shares.sh # Share directory recreation from cfg fil