Guides for ZFS Full backup to NFS drive and restore from NFS drive

mike tancsa mike at sentex.net
Mon Oct 7 12:28:36 UTC 2019


On 10/5/2019 8:35 AM, Alejandro Imass wrote:
> Nope you definitely understood the question precisely.
> What I want to do now is backup the entire system, reconstruct the raid1
> pool and then restore the whole system INTACT.
>
Something like this ?

You have the entire system snapshotted into a file

snapshot -r zroot at level0
zfs send -Rv zroot at level0 | gzip > /nfsmount-on-nfs-server/level0-backup.gz

On the box where you will do the restore to two fresh drives. I usually
do just a netboot.  Best not to do it on a system that has the same zfs
name (eg two zroots) as it confuses things.

gpart destroy -F ada0
gpart destroy -F ada1
gpart create -s gpt ada0
gpart create -s gpt ada1
gpart add -s 222 -t freebsd-boot ada0
gpart add -s 222 -t freebsd-boot ada1
gpart add -s 8g -t freebsd-swap ada0
gpart add -s 8g -t freebsd-swap ada1
gpart add -t freebsd-zfs  ada0
gpart add -t freebsd-zfs  ada1
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

#make sure /mnt2 exists
zpool create -f -o altroot=/mnt2 -O canmount=off -m none zroot mirror /dev/ada0p3 /dev/ada1p3

gzcat  /nfsmount-on-nfs-server/level0-backup.gz  | zfs recv -vF zroot
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

#import it, but its probably already there so dont worry about the error
zpool import -f -o altroot=/mnt2  zroot
zpool set bootfs=zroot/ROOT/default zroot


	---Mike



More information about the freebsd-questions mailing list