From owner-freebsd-questions@freebsd.org Mon Sep 26 17:34:29 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3E88BEA839 for ; Mon, 26 Sep 2016 17:34:29 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost1-64-7-128-1.sentex.ca (smarthost1jail.sentex.ca [IPv6:2607:f3e0:0:c::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D6ACBB7 for ; Mon, 26 Sep 2016 17:34:29 +0000 (UTC) (envelope-from mike@sentex.net) Received: from [192.168.43.26] (pyroxene.sentex.ca [199.212.134.18]) by smarthost1-64-7-128-1.sentex.ca (8.15.2/8.14.8) with ESMTP id u8QHYRWF073274; Mon, 26 Sep 2016 17:34:27 GMT (envelope-from mike@sentex.net) Subject: Re: complete clone/restore from a ZFS-based system replication stream To: Victor Sudakov , freebsd-questions@freebsd.org References: <20160926154720.GA75556@admin.sibptus.transneft.ru> From: Mike Tancsa Organization: Sentex Communications Message-ID: <688eec35-bc7b-ae05-b765-106933b522d1@sentex.net> Date: Mon, 26 Sep 2016 13:34:03 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20160926154720.GA75556@admin.sibptus.transneft.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2016 17:34:29 -0000 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/