Status quo

I have an HP ProLiant Microserver Gen8 which has four (4) Non-hot-swappable hard disk bays, currently stuffed with 5400rpm and 7200rpm Western Digital Red drives (WD40EFRX and VBWD4003FFBXGX) with 4TB capacity each.

It’s one of those little cuties here:

HP ProLiant Microserver Gen8

When using TrueNAS you might have stumbled over the topic of ZFS which is set up as RAID-Z1 using all four disks as vdevs which means one of those comes as a redundancy drive.

This machine boots using the microSD card slot on the motherboard directly.

Backup your TrueNAS Pool to an external USB disk

As I am eager to achieve the 3-2-1 backup system I am planning to copy the internal files from the server to a first external disk, which is connected all the time and to a second external disk which must be disconnected most of the time to account for external disaster cases like a fire or power problems.

I have my WD Elements 10TB USB 3.0 Type-A connected which is NTFS formatted because it came like it and I did not change it ever since.

WD Elements

Linux usually is perfectly capable to handling NTFS as I have used it and it is handy to have the backup at hand without further fiddling around with a live USB stick or something, of course, you just connect it to your Windows computer and you are good to go.

So how are we copying files to the external disk?

Multiple possibilities seem to exist, from copying files directly using the TrueNAS Linux with rsync and cronjobs to plugin jails with extra software like Syncthing or similar.

First I thought about using borg which handled my current backup of a different UNRAID server well but with the advantages it brings, compression and an organized backup structure (multiple backups, months, weeks, days and all that) it also comes with the caveat that you have to use borg to extract your backup once you have to restore anything which makes it inconvenient to use with anything other than linux.

And I am using rsync here since it’s conveniently pre-installed and good enough for mirroring directories, which is what I’m handling on the Linux level. Don’t have to handle any jails with their additional virtualization load or shares whatsoever. Rsync supports intelligently “updating” the remote / disk location, so if nothing changes say inside my media storage, nothing will be copied.

So I set up an rsync script which is being run once in the night using a cronjob. This script will have all the copy / backup logic in one place and it must take an additional argument which will be the target path where the backup will be created.

This script would look like this

#!/bin/bash