{"id":33,"date":"2011-11-11T16:49:49","date_gmt":"2011-11-11T15:49:49","guid":{"rendered":"http:\/\/esxi-v34\/wordpress\/?p=33"},"modified":"2013-01-27T00:10:04","modified_gmt":"2013-01-26T23:10:04","slug":"restore-a-freebsd-installation-through-zfs-sendrecieve","status":"publish","type":"post","link":"\/wordpress\/freebsd\/restore-a-freebsd-installation-through-zfs-sendrecieve\/","title":{"rendered":"Restore a FreeBSD installation through ZFS send\/recieve"},"content":{"rendered":"<p>Boot into RescueCD onto receiving machine. Then create GPT partitioning scheme (If a new machine and assuming ad0 is the disk)<\/p>\n<pre><code>gpart create -s gpt ad0<\/code>\r\n<code>gpart add -t freebsd-boot -s 64K ad0<\/code>\r\n<code>gpart add -t freebsd-swap -s 2G -l swap0 ad0<\/code>\r\n<code>gpart add -t freebsd-zfs -l disk0 ad0<\/code>\r\n<code>gpart bootcode -b \/dist\/boot\/pmbr -p \/dist\/boot\/gptzfsboot -i 1 ad0<\/code><\/pre>\n<p>Set up ssh keys and copy them over to the sending machine<\/p>\n<pre><code>ssh-keygen -t dsa<\/code>\r\n<code>cat .ssh\/id_dsa.pub|ssh &lt;sending machine&gt; dd of=\/root\/.ssh\/authorized_keys<\/code><\/pre>\n<p>Load the necessary kernel modules<\/p>\n<pre><code>kldload \/dist\/boot\/kernel\/opensolaris.ko<\/code>\r\n<code>kldload \/dist\/boot\/kernel\/zfs.ko<\/code><\/pre>\n<p>Make snapshots on sending machine<\/p>\n<pre><code>zfs snapshot -r &lt;zpool&gt;@now<\/code><\/pre>\n<p>Create zpool on receiving machine<\/p>\n<pre><code>zpool create &lt;zpool&gt;<\/code><\/pre>\n<p>Find out which snapshots to send<\/p>\n<pre><code>zfs list -t snapshot|grep now<\/code><\/pre>\n<p>Send\/Receive snapshots<\/p>\n<pre><code>for fs in &lt;output from above&gt;; do\r\n  ssh &lt;sending machine&gt;\r\n  zfs send ${fs}|zfs receive -d -F &lt;zpool&gt;\r\ndone<\/code><\/pre>\n<p>Set flags (compression, exec, &#8230;). Then set mountpoints.<\/p>\n<pre><code>export LD_LIBRARY_PATH=\/dist\/usr<\/code>\r\n<code>zfs unmount -a<\/code>\r\n<code>zfs set mountpoint=legacy &lt;zpool&gt;<\/code>\r\n<code>zfs set mountpoint=\/tmp &lt;zpool&gt;\/tmp<\/code>\r\n<code>zfs set mountpoint=\/usr &lt;zpool&gt;\/usr<\/code>\r\n<code>zfs set mountpoint=\/var &lt;zpool&gt;\/var<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Boot into RescueCD onto receiving machine. Then create GPT partitioning scheme (If a new machine and assuming ad0 is the disk) gpart create -s gpt ad0 gpart add -t freebsd-boot -s 64K ad0 gpart add -t freebsd-swap -s 2G -l swap0 ad0 gpart add -t freebsd-zfs -l disk0 ad0 gpart bootcode -b \/dist\/boot\/pmbr -p \/dist\/boot\/gptzfsboot <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"\/wordpress\/freebsd\/restore-a-freebsd-installation-through-zfs-sendrecieve\/\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[18,31,13,2],"_links":{"self":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/33"}],"collection":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":9,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":111,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/33\/revisions\/111"}],"wp:attachment":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}