Backing up your NAS with Duplicati
If you're running a network attached storage solution then you should really be thinking of how you plan to back that up in case of emergency. I want to specifically state here that RAID is not a backup solution. If all of your RAID HDDs fail at the same time then your data will be at risk; also speaking for a Forensics perspective, it can be difficult to recover data from a failed RAID HDD.
You really should be thinking about how you are going to backup your data. For this tutorial I'll be setting up the excellent, and free, Duplicati.
What is Duplicati
Duplicati is a linux based program that can automatically backup your data to another server somewhere. These servers can be located in the cloud like Google Drive/Amazon S3/OneDrive, or it can be another NAS stored offsite.
Duplicati supports AES256 encryption and uses data blocks to back up data. This means that Duplicati does not do individual file backups, so if you're looking for a backup solution where you can interact with the data at the offsite location then Duplicati isn't for you. I would however say that you should not ever be working directly with your backup, and it's hard to beat the price of free.
Set up with Portainer
I mentioned this in a previous article but I really like Portainer. It's a GUI for managing Docker. If you're not sure how to set up Docker and Portainer then you can reference this guide.
In portainer go to create a new service
Name the container whatever you want and set the image to linuxserver/duplicati
Set the ports to 8200. Like other containers you can set the host port to whatever you want if you want to use something other than 8200.
You'll need to make three volumes for this but only one of them really matters. You can place /config and /backups wherever you want. /source needs to be the location of the data that you want to backup. In this example I'm backing up my user's (pi's) folders. So those are the sources. If you have multiple users than you might want to set source to /home that way you can backup multiple users.
Finally set the restart policy to unless stopped and deploy the container.
After the container is deployed you can go to http://ip:8200 to get to the Duplicati gui. On a new install it'll ask you about setting a password.
I'll let you ultimately make that decision. Once you've decided hit the add backup option. You'll be asked if you want to import from a configuration file or set up a new one. We're going to set up a new one.
On the next page you'll be asked what you want to call the backup and if you want to encrypt it.
NOTE: Encryption will take more system resources and slow down your backups initially. However because of how Duplicati works this should only really happen the first time. Duplicati does versioning chunks of data and only backs up a chunk if it's changed so one the first backup has been completed the rest should be much quicker and encryption won't be as taxing.
The next page will ask you where you want to back up too. It defaults to local storage but remember that local storage isn't a proper backup. Fortunately Duplicati supports many different proprietary cloud services.
Pick your offsite service, enter the username and password and proceed to the next page.
Select the folders you want to backup. This is where the /source from earlier comes into play. Pick the files or folders you want, set any filters or exclusions you don't want to backup. You have some fairly extensive filtering options to keep your backups from going crazy. For instance you may not want to backup generic system files. Or maybe you don't want to backup readme files. If your limited on storage space maybe you only want to backup documents and not virtual machine hard drives. You can filter all of these.
Pick the schedule for backups.
You have a few options here. I've thrown some random settings here just to give you an example. 50Mb is the default and it's generally not advisable to change this. The advanced option settings have a lot of options. A lot.
Hit save and then you have a working backup.
Duplicati is an excellent program for backing up servers. It's easy to set up