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

mike tancsa mike at
Mon Oct 7 15:19:15 UTC 2019

On 10/7/2019 11:14 AM, Alejandro Imass wrote:
> On Mon, Oct 7, 2019 at 8:28 AM mike tancsa <mike at
> <mailto:mike at>> wrote:
>     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 ?
> Wow Mike ! Thanks a lot for taking the time to provide this step by
> step recipe!!
> I will go over it and try it out and document the whole thing with
> explanations etc. to try to push some of this info onto the handbook
> so that regular users like myself will be able to deal with these
> common scenarios. 
> I'll keep the list posted on this thread...
> Thanks again!!

No problem. Some other notes, if you want to create an actual image that
you then want to virtualize, you can use mdconfig to experiment with

*Note, if you are restoring a RELENG_10 image* on a RELENG11 image, make
sure you grab the boot loader info from a matching RELENG_ image. Also,
be aware that if you have a pool name that is not zroot, set the bootfs

Another important note-- if you want to import a RELENG_10 zfs file
system into a vm image and then boot that image, you will need to create
the zpool image with all feature flags disabled on RELENG12 as the
version is different. The *option -d* will do this. Dont forget to use
the same boot info as well. So pmbr and gptzfsboot should be sourced
from a releng_10 image.

#create a RELENG10 vm and then work with it on releng_12
rm server.img
truncate -s 1TB server.img
mdconfig -f server.img
gpart create -s gpt md0
gpart add -s 512 -t freebsd-boot md0
gpart add -s 1G -t freebsd-swap md0
gpart add -t freebsd-zfs md0
gpart bootcode -b /tmp/pmbr -p /tmp/gptzfsboot -i 1 md0
zpool create -d -f -o altroot=/mnt2 -O canmount=off -m none zroot /dev/md0p3
gzcat zroot-.0.gz | zfs recv -vF zroot
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 md0
zpool import -f -o altroot=/mnt2  zroot
zpool set bootfs=zroot/ROOT/default zroot

Some common problems-- if the machine you are virtualizing does NOT have
the virtio drivers, make sure the disk driver you choose in KVM is SATA.
Otherwise you get a cryptic "cannot file zfs pool labeled xxx"... thats
because there is no "disk" seen by the kernel. Change the driver to be
SATA then. Same with network drivers etc. You can load them via kld at
the loader prompt if they are not compiled in


More information about the freebsd-questions mailing list