{"id":219,"date":"2016-06-30T10:41:21","date_gmt":"2016-06-30T08:41:21","guid":{"rendered":"http:\/\/blog.matthias.roehser.de\/?p=219"},"modified":"2018-12-19T11:33:17","modified_gmt":"2018-12-19T10:33:17","slug":"some-zfs-commands","status":"publish","type":"post","link":"https:\/\/blog.matthias.roehser.de\/?p=219","title":{"rendered":"Some zfs commands"},"content":{"rendered":"<p>Query status of pool:<\/p>\n<pre>zpool status<\/pre>\n<p>Check filesystem:<\/p>\n<pre>zpool scrub tank<\/pre>\n<p>Create snapshot with name derived from current date:<\/p>\n<pre>zfs snapshot tank\/data@'date +%Y-%m-%d' (Replace ' with backticks)\n\n<\/pre>\n<p>List snapshots:<\/p>\n<pre>zfs list -t snapshot<\/pre>\n<p>Destroy snapshot:<\/p>\n<pre>zfs destroy tank\/data@snapshotname\n\n<\/pre>\n<p>Send snapshot over network:<\/p>\n<pre class=\"prettyprint nocolor\"><span class=\"pln\">zfs send tank<\/span><span class=\"pun\">\/data<\/span><span class=\"pln\">@snapshot \u00a0<\/span><span class=\"pun\">|<\/span><span class=\"pln\"> ssh root@192.168.1.1<\/span><span class=\"pln\"> zfs recv tank<\/span><span class=\"pun\">\/data<\/span><\/pre>\n<p>Send snapshop unencrypted, but very fast via nc:<\/p>\n<pre class=\"prettyprint nocolor\"><span class=\"pln\">nc <\/span><span class=\"pun\">-<\/span><span class=\"pln\">w <\/span><span class=\"lit\">120<\/span> <span class=\"pun\">-<\/span><span class=\"pln\">l <\/span><span class=\"pun\">-<\/span><span class=\"pln\">p <\/span><span class=\"lit\">8000<\/span> <span class=\"pun\">|<\/span><span class=\"pln\"> zfs receive tank\/data\n<\/span><\/pre>\n<pre class=\"prettyprint nocolor\"><span class=\"pln\">zfs send tank<\/span><span class=\"pun\">\/data<\/span><span class=\"pln\">@snapshot\u00a0<\/span><span class=\"pun\">|<\/span><span class=\"pln\"> nc <\/span><span class=\"pun\">-<\/span><span class=\"pln\">w <\/span><span class=\"lit\">20<\/span> <span class=\"lit\">192.168.1.1<\/span> <span class=\"lit\">8000\n<\/span><\/pre>\n<p>Send incremental snapshots:<\/p>\n<pre><span class=\"pln\">zfs send -i tank<\/span><span class=\"pun\">\/data<\/span><span class=\"pln\">@snapshot1 tank\/data@snapshot2 \u00a0<\/span><span class=\"pun\">|<\/span> <span class=\"pln\">zfs recv anothertank<\/span><span class=\"pun\">\/data<\/span><\/pre>\n<p>In case there are changes on the destination filesystem, the snapshot cannot be added and need to be rolled back. This can be done automatically using the -F flag:<\/p>\n<pre><span class=\"pln\">zfs send -i tank<\/span><span class=\"pun\">\/data<\/span><span class=\"pln\">@snapshot1 tank\/data@snapshot2 \u00a0<\/span><span class=\"pun\">|<\/span> <span class=\"pln\">zfs recv -F <\/span><span class=\"pun\"><span class=\"pln\">anothertank<\/span>\/data<\/span><\/pre>\n<p>Start transfer and detach process, so shell can be closed. Useful for very long running transfers:<\/p>\n<pre>sudo -b nohup sh -c \"sudo zfs send backup\/archiv@2017-11-04 | sudo zfs recv extern\/archiv\"<\/pre>\n<p>Edit mount point:<\/p>\n<pre>zfs set mountpoint=\/mnt tank\/data<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Query status of pool: zpool status Check filesystem: zpool scrub tank Create snapshot with name derived from current date: zfs snapshot tank\/data@&#8217;date +%Y-%m-%d&#8217; (Replace &#8216; with backticks) List snapshots: zfs list -t snapshot Destroy snapshot: zfs destroy tank\/data@snapshotname Send snapshot over network: zfs send tank\/data@snapshot \u00a0| ssh root@192.168.1.1 zfs recv tank\/data Send snapshop unencrypted, but [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-219","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=\/wp\/v2\/posts\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=219"}],"version-history":[{"count":10,"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=\/wp\/v2\/posts\/219\/revisions"}],"predecessor-version":[{"id":245,"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=\/wp\/v2\/posts\/219\/revisions\/245"}],"wp:attachment":[{"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.matthias.roehser.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}