Backup your Unraid Server with LuckyBackup
/In this guide we will backing up Unraid to another Unraid server using LuckyBackup. While the steps to make this happen may seem daunting, they are actually very simple and mostly painless!
What is LuckyBackup
LuckyBackup is a very user-friendly GUI backup container that uses rsync on the backend and only transfers over any changes rather than all your data, all of the time.
Features
Backup using snapshots
Various checks to keep data safe
Simulation mode
Remote connections
Easy restore procedure
Add/remove any rsync option
Synchronize folders
Exclude data from tasks
Execute other commands before or after a task
Scheduling (cron jobs)
Tray notification support
e-mail reports
Security Warning
Please note that it is not best practice to use the ‘root’ user to execute backups. It is very common for administrators to create a specific account/non-user account to perform the backups of a system or server. Please use this guide as a learning tool and whenever possible, practice good cybersecurity techniques.
The Setup
This is an extremely simple diagram showing how the network is setup. Both the Main Server and Backup Server are plugged into the same 10Gigabit switch. The Main Server is where all of my files, pictures, videos, and ISO’s are; we want to essentially copy those over to our Backup Server just in case something goes wrong. Both servers are running Unraid. The Backup Server has pre-created Shares that are named identically to my Main/Primary Server.
Guide
Unraid Version: 6.9.2
Community Apps Version: 2022.01.02a
Main Server IP Address: 192.168.1.8
Backup Server IP Address: 192.168.1.9
This guide assumes you have the Community Apps Plugin already installed.
Setup Main Server
Using the Community Apps Plugin, go ahead and search, download, and install the luckyBackup container by ich777
Once it is installed we need to make some basic configuration changes
Change “Console Shell Command:” to Bash
Optional Change “WebGUI:” to unused port number
Set “Run as root user:” to true
Here is my configuration as an example.
Setup LuckyBackup Container
This will arguably be the hardest part. Take your time! We need to generate SSH Keys so we can rsync (copy data) between servers without using a password and without manual intervention.
First in the Docker tab left-click on the luckyBackup container and open a console window. The container should be running/started at this point.
Then we need to enter in the following commands into the Console window.
ssh-keygen -t rsa
Press the ‘Enter’ key three times to let the command create default paths and empty Passphrases
scp /root/.ssh/id_rsa.pub 192.168.1.9:/root/.ssh/
When prompted to add 192.168.1.9 to the list of known hosts, type ‘yes’
Enter your servers’ password if necessary
Type ‘exit’ and close the Console window as necessary.
Stop and Start the luckyBackup container
Step 1: Example from above, ssh-keygen -t rsa
Step 2: Example from above, scp /root/.ssh/id_rsa.pub 192.168.1.9:/root/.ssh/
Step 3: Example from above, typing ‘exit’ into the Console window
Setup the Backup Server
Now we will need to create or edit a file called ‘authorized_keys’. This is very simple to do, the hardest part is locating the “Web Terminal” icon that looks like “>_”. By default it is in the top right corner of the WebUI. You will do this on your backup server.
First enter the following commands into your Web Terminal.
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
exit
Done. See not so bad, below is an example picture. After you are done you can close or exit this window if you haven’t done so already.
Configure LuckyBackup
In my example we will be only backing up individual Shares, however, you can back up all Shares at once. Just be careful not to copy your appdata directory from your primary server over top of your backup servers’ appdata directory. It can be easy to overwrite data if you aren’t careful. In this example I will be backing up a share called “isos”. Warning a bug exists that will crash the container and will cause you to start all the way over, please follow directions explicitly.
You will want to ‘+add’ a new task, it’s a button on the right side of the GUI
Fill out the following information
Name: backupISOs
Type: Synchronize Source and Destination
Source: /mnt/user/isos
Destination: /mnt/user
Click the ‘Okay’ button. This is where the bug may occur
Select the task you just named, ‘backupISOs’
Click the ‘modify’ button
Click the ‘Advanced’ button
Update the Destination path to match the source path. Destination: /mnt/user/isos
Click on the ‘Remote’ tab
Check the ‘Use remote host’ box
Under destination specify the user, in my example I am using root
User: root
@host: 192.168.1.9 <your backup server IP Address>
Check the ‘ssh’ box and fill in the following
port: 22
private key file: /root/.ssh/id_rsa
Click the ‘Okay’ button
Congratulations, you are ready to backup your server. Here is my configuration as an example.
Execute a Backup
Starting a backup is simple. Assuming you did everything above correctly you can now select a single task or multiple tasks and begin running them. To do this, perform the following steps.
Click the checkbox next to the task you want to run, this will enable/select the Task named ‘backupISOs’
Click the ‘Run’ button
“Sit back relax and enjoy a nice warm cup of Yorkshire Tea” -Spiffing Brit
Assuming you did everything correctly, you should see output like this example.
Finally we can also verify that our Share on our backup server is now populated with ISO’s.
Questions?
Can my backup server be a different Operating System or system, e.g QNAP, TrueNAS/FreeNAS, Synology, etc?
Yes, you can use any other linux distribution for your backup system. The differences will more than likely be in file/directory structure. Generally, most linux distributions have the commands we used, built into them.
Why are you using two Unraid Servers?
Because I like it and it feels good. Seriously though, having the same operating system on both ends just makes it easy but mostly because I want to support Limetech as much as possible.
Can this be done over a VPN, let’s say Wireguard?
Yes. I’d recommended reading this post on Unraid.net to learn more.
Where can I get additional support?
https://forums.unraid.net/topic/83786-support-ich777-application-dockers/