Take a snapshot of the zpool you wish to backup
zfs snapshot tank@backup-jan-2020
Find the drive path for the external drive
For example, with a 64GB USB drive:
fdisk -l | grep 'Disk /dev'
[...]
Disk /dev/sdn: 62.4 GB, 62411243520 bytes, 121896960 sectors
/dev/sdn
is the path we're interested in and will use in this tutorial.
Create a zpool on the destination drive. No need to format the drive.
zpool create backup1 /dev/sdn
Send the snapshot to the external drive, this may take some time.
zfs send tank@backup-jan-2020 | pv | zfs recv -F backup1
Compare the size of the snapshot on your data volume to the snapshot on the external volume.
The REFER amount should match.
zfs list -t snapshot | grep 'backup-jan-2020'
NAME USED AVAIL REFER MOUNTPOINT
tank@backup-jan-2020 392K - 1.79T -
backup1@backup-jan-2020 0B - 1.79T -
Export the external zpool so your machine isn't looking for it
zpool export backup1
udisksctl power-off -b /dev/sdn
Import the external zpool by name, or use zfs import
to find the name
zfs import backup1
This should automatically mount it at /backup1
, if not use zfs mount backup1
to force a mount.
Ensure a backup snapshot is present on the external drive
zfs list -t snapshot | grep backup1
NAME USED AVAIL REFER MOUNTPOINT
backup1@backup-jan-2020 0B - 1.79T -
Send the snapshot to the data volume, this may take some time.
zfs send backup1@backup-jan-2020 | pv | zfs recv tank
Compare the size of the snapshot on your data volume to the snapshot on the external volume.
The REFER amount should match.
zfs list -t snapshot | grep 'backup-jan-2020'
NAME USED AVAIL REFER MOUNTPOINT
tank@backup-jan-2020 392K - 1.79T -
backup1@backup-jan-2020 0B - 1.79T -
Roll back to the snapshot to make the data active
zfs rollback tank@backup-jan-2020