-
Notifications
You must be signed in to change notification settings - Fork 0
FirstBackup
We will see the first backup operation, which is different from the others because it will transfer all of the filesystem to the destination.
In case of a filesystem with previous snapshots, if you specify a different configuration file for a different destination, a "first backup" operation will be performed, transferring all snapshots.
user@nas:~/src$ mkdir -p ~/src
user@nas:~/src$ cd src
user@nas:~/src$ git clone https://github.com/finzic/zfs-backup.git
We will create a sample backup configuration file.
- Our source will be
zfspool/Documentson the NAS server; - Our destination will be
backuppool/DocumentsBackupon the BACKUP serverbackupwith the userbuser
user@nas:~/src$ cd ~/src/zfs-backup
nano -w ExampleDocuments.bkp
In the nano editor type as follows:
SRC_POOL=zfspool
SRC_DATASET=Documents
DST_POOL=backuppool
DST_DATASET=DocumentsBackup
DST_USERNAME=buser
DST_ADDR=backup
Save your file. You're good to go with your first backup! Let's do it!
Let's see that there are no previous snapshots in the nas system:
user@nas:~/src/zfs-backup$ zfs list -t snapshot
no datasets available
user@nas:~/src/zfs-backup$
Now let's see that we have some data usage:
user@nas:~/src/zfs-backup$ zfs list
NAME USED AVAIL REFER MOUNTPOINT
zfspool 476M 18.6G 128K /mnt/raid
zfspool/Documents 474M 18.6G 474M /mnt/raid/Documents
user@nas:~/src/zfs-backup$
OK, we have nearly 500MB worth of data.
Let's back it up:
user@nas:~/src/zfs-backup$ ./zfs-backup.sh -b ExampleDocuments
####################################################################################################
ZFS Backup Script - server name = nas
####################################################################################################
Starting Zfs Backup - Backup operation requested.
Backing up zfspool/Documents to remote server backup as remote user buser on backuppool/DocumentsBackup
no datasets available
Snapshot performed correctly: zfspool/Documents@2024.07.26-00.48.47
Latest Snapshot is zfspool/Documents@2024.07.26-00.48.47
Finding differences between zfspool/Documents@2024.07.26-00.48.47 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.07.26-00.48.47
The dataset DocumentsBackup is not present in the REMOTE backup system.
Calculating MD5SUMs for all files on the local server - please wait...
Calculating md5sums parallelizing 4x...
ETA: 0s Left: 46 AVG: 0.00s local:1/2/100%/0.0s
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.04s local:0/48/100%/0.0s
Fixing paths in md5sums file...
Substituting Documents with DocumentsBackup in md5sums file...
... MD5SUMs done.
Preparing to send the whole dataset with all its snapshots...
Estimated size of zfspool/Documents is : 474M
Current LOCAL snapshot is zfspool/Documents@2024.07.26-00.48.47
Sending all dataset to backup system...
receiving full stream of zfspool/Documents@2024.07.26-00.48.47 into backuppool/DocumentsBackup@2024.07.26-00.48.47
480MiB 0:00:06 [74.2MiB/s] [74.2MiB/s] [==============================================================================================================] 101%
received 481M stream in 6.78 seconds (70.9M/sec)
... Everything OK
Sending all dataset to backup system... Completed
Retrieving mountpoint for remote backup system dataset...
Remote backup system dataset mountpoint is: /mnt/storage
source pool = zfspool
source dataset = Documents
---
destination address = backup
destination username = buser
destination pool = backuppool
destination dataset = DocumentsBackup
####################################################################################################
Sending md5sums file to remote system...
md5-DocumentsBackup.txt 100% 4770 3.4MB/s 00:00
Checking remote md5sums, please wait...
DocumentsBackup/Richiesta Appuntamento.PDF: OK
[...]
remote md5sum are correct.
Setting remote dataset as readonly...
Remote dataset backuppool/DocumentsBackup set as readonly.
Backup operations completed successfully.
user@nas:~/src/zfs-backup$
Now let's check that we have a new local snapshot:
user@nas:~/src/zfs-backup$ zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
zfspool/Documents@2024.07.26-00.48.47 117K - 474M -
user@nas:~/src/zfs-backup$
Fair enough!
Now let's check that we have a similar snapshot on the backup server:
buser@backup:~$ zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
backuppool/DocumentsBackup@2024.07.26-00.48.47 88K - 474M -
buser@backup:~$
Impressive, isn't it?
Now we're ready to check this on our Windows PC.
Go to Remote Samba Server Configuration then.
ZFS Backup, (c) 2024 Luca Finzi Contini - Use it at your own risk but enjoy doing so :)