Date: Mon, 26 Sep 2016 13:34:03 -0400 From: Mike Tancsa <mike@sentex.net> To: Victor Sudakov <vas@mpeks.tomsk.su>, freebsd-questions@freebsd.org Subject: Re: complete clone/restore from a ZFS-based system replication stream Message-ID: <688eec35-bc7b-ae05-b765-106933b522d1@sentex.net> In-Reply-To: <20160926154720.GA75556@admin.sibptus.transneft.ru> References: <20160926154720.GA75556@admin.sibptus.transneft.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On 9/26/2016 11:47 AM, Victor Sudakov wrote: > Dear Colleagues, > > I have a complete dump of a working system created by > 'zfs send -Rv zroot@test1 > test1.zfs '. I think it's called a > replication stream package. I also have a new hard drive. Then I > create the freebsd-boot, freebsd-swap and freebsd-zfs partitions on > the new drive, install the bootloader on it. > > Now what command exactly do I use to restore the system from > test1.zfs? I have tried "zfs receive" with different combinations of > options but each time I and with some error message like "destination > exists..." > > Please refer me to a good howto on restoring a system from a > replication stream package. Here are the steps I used to restore a "level zero" zfs file onto a new/fresh mirror. 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 -s 400g ada0 gpart add -t freebsd-zfs -s 400g 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 /mnt/zroot-.0.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 ... You should now be able to boot off the restored mirror. ---Mike -- ------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet services since 1994 www.sentex.net Cambridge, Ontario Canada http://www.tancsa.com/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?688eec35-bc7b-ae05-b765-106933b522d1>