Skip to content

BackupToMultipleDestinations

Luca Finzi Contini edited this page Oct 29, 2024 · 7 revisions

Backup to Multiple Destinations

The zfs-backup.sh script lets you easily manage more than one backup server destination.

It is as easy as to write multiple backup descriptors! As you already saw in the case of different snapshots backed up at a later time, it is basically the same with multiple backup destinations:

Suppose you have your backup server that is used for normal backup, and a second backup server, in this case remotebackup, that simulates a remotely located backup server. This is actually a clone of the backup server I made after the first backup from nas.

In order for us to execute another backup to remotebackup, all we need to do is write a new backup descriptor, which is almost identical to the original one in this case:

SRC_POOL=zfspool
SRC_DATASET=Documents

DST_POOL=backuppool
DST_DATASET=DocumentsBackup

DST_USERNAME=buser
DST_ADDR=remotebackup

Create a file with the content above in the zfs-backup folder and name it e.g. ExampleDocumentsRemoteBackup.bkp.

Please note that in this case the only difference is that the DST_ADDR key has the value remotebackup instead of backup. This is because remotebackup is a clone of backup server, which differs only for the hostname. This is why all other values are the same. In any case, it would be only a matter of using the right values for your other backup destination.

Initial Situation

This is the situation before starting the backup on remotebackup: we have nas and backup perfectly aligned, and remotebackup which has not been used in a while, as the Previous Versions tab shows us

Multiple Destinations - before remote backup

Backup to different destination

Here is the command launched on nas and its output:

user@nas:~/src/zfs-backup$ ./zfs-backup.sh -b ExampleDocumentsRemoteBackup

####################################################################################################
                 ZFS Backup Script - server name = nas
####################################################################################################

Starting Zfs Backup - Backup operation requested.
Backing up zfspool/Documents to remote server remotebackup as remote user buser on backuppool/DocumentsBackup
Latest Snapshot is zfspool/Documents@2024.10.27-22.18.59
Finding differences between zfspool/Documents@2024.10.27-22.18.59 and current status of zfspool/Documents - this could take some time...
There are no local differences -> the latest local snapshot will be considered as current snapshot.

Current local snapshot = zfspool/Documents@2024.10.27-22.18.59

The dataset "DocumentsBackup" is already present in the REMOTE backup system.
Retrieving mountpoint for remote backup system dataset...
Remote backup system dataset mountpoint is: /mnt/storage
source pool             = zfspool
source dataset          = Documents
---
destination address     = remotebackup
destination username    = buser
destination pool        = backuppool
destination dataset     = DocumentsBackup
####################################################################################################
=== Checking snapshot alignment between REMOTE and LOCAL systems
Last snapshot date on REMOTE system is : 2024.07.26-00.48.47
Last snapshot date on LOCAL  system is : 2024.10.27-22.18.59
There is a snapshot with the same date on LOCAL system.
Finding all modifications from zfspool/Documents@2024.07.26-00.48.47 to zfspool/Documents@2024.10.27-22.18.59...
Determining changed files...
Determining moved files...
Determining deleted files...
There are 5 changed files, 8 deleted files and 0 moved files.
Remote is aligned with local? false
Calculating md5sums parallelizing 4x...

Computers / CPU cores / Max jobs to run
1:local / 2 / 2

Computer:jobs running/jobs completed/%of started jobs/Average seconds to complete
ETA: 0s Left: 0 AVG: 0.20s  local:0/5/100%/0.2s
Fixing paths in md5sums file...
Substituting Documents with DocumentsBackup in md5sums file...
Calculating data transfer size approximation...
Approximate transfer size is 82M
Sending snapshot...
receiving incremental stream of zfspool/Documents@2024.10.27-21.59.11 into backuppool/DocumentsBackup@2024.10.27-21.59.11
received 825K stream in 0.41 seconds (1.96M/sec)
receiving incremental stream of zfspool/Documents@2024.10.27-22.13.33 into backuppool/DocumentsBackup@2024.10.27-22.13.33
81.7MiB 0:00:03 [21.8MiB/s] [21.8MiB/s] [===============================================================> ]  99%
received 80.8M stream in 6.08 seconds (13.3M/sec)
receiving incremental stream of zfspool/Documents@2024.10.27-22.15.19 into backuppool/DocumentsBackup@2024.10.27-22.15.19
received 85.1K stream in 0.12 seconds (733K/sec)
receiving incremental stream of zfspool/Documents@2024.10.27-22.18.59 into backuppool/DocumentsBackup@2024.10.27-22.18.59
received 101K stream in 0.10 seconds (1.02M/sec)
Sending md5sums file to remote system...
md5-DocumentsBackup.txt                                                                   100%  355   186.9KB/s   00:00
Checking remote md5sums, please wait...
DocumentsBackup/file-4.txt: OK
DocumentsBackup/file-5.txt: OK
DocumentsBackup/NewFileModified.txt: OK
DocumentsBackup/ticketdirect1255135933.pdf: OK
DocumentsBackup/WNA1100_Setup-V2.2.0.1-1_signed.zip: OK
remote md5sum are correct.
Backup operations completed successfully.
user@nas:~/src/zfs-backup$

As we can see, it does look similar to the output we got when we backed up multiple snapshots to our "normal" server.

Final Situation

This is the final situation of snapshots on both backup servers:

Multiple Destinations - after remote backup - snapshots

This is the final situation of the Previous Versions tabs of the three servers:

Multiple Destinations - after remote backup - Previous Versions

Now let's head to some very important maintenance topics: let's start with Basic Disk Management

Clone this wiki locally