{"id":733,"date":"2015-08-01T01:24:13","date_gmt":"2015-08-01T05:24:13","guid":{"rendered":"http:\/\/www.rfdm.com\/blog\/?p=733"},"modified":"2015-08-22T02:18:27","modified_gmt":"2015-08-22T06:18:27","slug":"first-zfs-pool-now-on-kiva","status":"publish","type":"post","link":"https:\/\/www.rfdm.com\/blog\/?p=733","title":{"rendered":"First ZFS pool now on kiva"},"content":{"rendered":"<p>I finally got around to creating the first ZFS pool on my new-to-me server (kiva).  At the moment, this particular pool is for backups of other machines.<\/p>\n<p>I am using the 4TB HGST Deskstar drive I bought a little bit ago, and a 4TB HGST Deskstar NAS I bought today.  Once installed in hot-swap bays, they showed up as <tt>da1<\/tt> and <tt>da2<\/tt>.<\/p>\n<p>I created the GPT partitioning scheme on each:<\/p>\n<pre style=\"font-size: 14px\">\r\n# gpart create -s gpt da1\r\n# gpart create -s gpt da2\r\n<\/pre>\n<p>I created a partition on each, leaving 2 gigabytes of space unused.  It&#8217;s not uncommon for a replacement drive to have slightly less space, and I don&#8217;t want to be trapped in a jam if one of the drives fails and I need to use a different type of drive as a replacement.  2 gigabytes seems like a lot of space, but in the grand scheme of this ZFS host, it&#8217;s nothing.  On FreeBSD, there is no performance penalty for using partitions for ZFS versus using whole disks.  This allows me to wait to buy a replacement disk, which means I don&#8217;t have spare disks sitting around with their warranty period ticking away without the drives being used.  I would always have spare drives on hand in a production environment, but at home it makes sense (especially for backups) to wait for a drive to have some trouble before purchasing its replacement.  4TB drives are readily available locally.<\/p>\n<pre style=\"font-size: 14px\">\r\n# gpart add -t freebsd-zfs -l gpzfs1_0 -b1M -s3724G da1\r\n# gpart add -t freebsd-zfs -l gpzfs1_1 -b1M -s3724G da2\r\n<\/pre>\n<p>So now I see:<\/p>\n<pre style=\"font-size: 14px\">\r\n% gpart show da1\r\n=>        34    7814037101  da1  GPT  (3.6T)\r\n          34          2014       - free -  (1.0M)\r\n        2048    7809794048    1  freebsd-zfs  (3.6T)\r\n  7809796096       4241039       - free -  (2.0G)\r\n\r\n% gpart show da2\r\n=>        34    7814037101  da2  GPT  (3.6T)\r\n          34          2014       - free -  (1.0M)\r\n        2048    7809794048    1  freebsd-zfs  (3.6T)\r\n  7809796096       4241039       - free -  (2.0G)\r\n<\/pre>\n<p>I created the pool:<\/p>\n<pre style=\"font-size: 14px\">\r\n# zpool create zfs1 mirror \/dev\/gpt\/gpzfs1_0 \/dev\/gpt\/gpzfs1_1\r\n<\/pre>\n<p>I created my filesystem heirarchy.  For now I only need my backups mount point.  Since FreeBSD now has lz4_compress enabled by default, I can use lz4 compression.  lz4 is considerably faster than lzjb, especially on incompressible data.<\/p>\n<pre style=\"font-size: 14px\">\r\n# zfs create -o compression=lz4 zfs1\/backups\r\n<\/pre>\n<p>And since I had not yet enabled ZFS on kiva, I added to <tt>\/boot\/loader.conf<\/tt>:<\/p>\n<pre style=\"font-size: 14px\">\r\nzfs_load=\"YES\"\r\n<\/pre>\n<p>And added to <tt>\/etc\/rc.conf<\/tt>:<\/p>\n<pre style=\"font-size: 14px\">\r\nzfs_enable=\"YES\"\r\n<\/pre>\n<p>After copying over 38 gigabytes of backups from another host, I have this:<\/p>\n<pre style=\"font-size: 14px\">\r\n% zpool list -v\r\nNAME               SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT\r\nzfs1              3.62T  23.9G  3.60T         -     0%     0%  1.00x  ONLINE  -\r\n  mirror          3.62T  23.9G  3.60T         -     0%     0%\r\n    gpt\/gpzfs1_0      -      -      -         -      -      -\r\n    gpt\/gpzfs1_1      -      -      -         -      -      -\r\n<\/pre>\n<p>lz4 compression yielded a 37% reduction in disk space for these backups.  That&#8217;s quite reasonable.<\/p>\n<p>A friend asked me why I was using a mirror.  The simple answer is that it&#8217;s more reliable than raidzN, and more easily expanded.  This machine has 12 hot-swap drive bays, and I don&#8217;t expect to need all of them anytime soon (if ever).  While a raidzN is more space-efficient, it&#8217;s not easily expanded and when one drive from a batch fails, others are often not far behind.  Resilvering a raidzN is hard on all of the drives involved, and it&#8217;s not uncommon to have another disk fail during a resilvering.  Resilvering a raidzN is slower than resilvering a mirror, and array performance suffers dramatically during resilvering of a raidzN.  If\/when I need to add more space to the pool, I can simply buy two more drives and add another mirror to the pool.<\/p>\n<p>It&#8217;s worth noting that ZFS is not a substitute for backups.  Here I am using ZFS to store backups of other machines, and it&#8217;s very useful for this use case.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I finally got around to creating the first ZFS pool on my new-to-me server (kiva). At the moment, this particular pool is for backups of other machines. I am using the 4TB HGST Deskstar drive I bought a little bit ago, and a 4TB HGST Deskstar NAS I bought today. Once installed in hot-swap bays, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.rfdm.com\/blog\/?p=733\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;First ZFS pool now on kiva&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,82],"tags":[],"class_list":["post-733","post","type-post","status-publish","format-standard","hentry","category-computing","category-freebsd-computing"],"_links":{"self":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=733"}],"version-history":[{"count":17,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/733\/revisions"}],"predecessor-version":[{"id":750,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/733\/revisions\/750"}],"wp:attachment":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}