{"id":752,"date":"2015-08-02T14:02:10","date_gmt":"2015-08-02T18:02:10","guid":{"rendered":"http:\/\/www.rfdm.com\/blog\/?p=752"},"modified":"2015-08-20T21:39:10","modified_gmt":"2015-08-21T01:39:10","slug":"depots-backup-space-is-now-zfs-mirror","status":"publish","type":"post","link":"https:\/\/www.rfdm.com\/blog\/?p=752","title":{"rendered":"depot&#8217;s backup space is now ZFS mirror"},"content":{"rendered":"<p>Last night I installed an HGST Deskstar NAS 4TB drive in depot to pair with the existing HGST Deskstar 4TB drive.  I saved the existing data to a ZFS pool on kiva, then wiped the existing HGST Deskstar drive: unmounted the filesystem, deleted the partition, deleted the partitioning scheme.<\/p>\n<p>If you&#8217;re doing this for the first time on FreeBSD 10.1 or later, don&#8217;t forget to enable ZFS (loading of the kernel module) and tell the system to mount ZFS pools at boot.<\/p>\n<p>Enable ZFS kernel module at boot by adding to <tt>\/boot\/loader.conf<\/tt>:<\/p>\n<pre style=\"font-size: 14px\">\r\nzfs_load=\"YES\"\r\n<\/pre>\n<p>Tell the system to mount ZFS pools at boot by adding to <tt>\/etc\/rc.conf<\/tt>:<\/p>\n<pre style=\"font-size: 14px\">\r\nzfs_enable=\"YES\"\r\n<\/pre>\n<p>If you haven&#8217;t rebooted after changing <tt>\/boot\/loader.conf<\/tt>, you can load the kernel module manually:<\/p>\n<pre style=\"font-size: 14px\">\r\n# kldload zfs\r\n<\/pre>\n<p>Before getting started, I changed the default ashift setting to be more amenable to 4k drives:<\/p>\n<pre style=\"font-size: 14px\">\r\n# sysctl vfs.zfs.min_auto_ashift=12\r\n<\/pre>\n<p>I then created my ZFS pool.  First I created the GPT partitioning scheme on each drive:<\/p>\n<pre style=\"font-size: 14px\">\r\n# gpart create -s gpt ada0\r\n# gpart create -s gpt ada4\r\n<\/pre>\n<p>I then created a partition on each, leaving 1 gigabyte of space unused:<\/p>\n<pre style=\"font-size: 14px\">\r\n# gpart add -t freebsd-zfs -l gpzfs1_0 -b1M -s3725G ada0\r\n# gpart add -t freebsd-zfs -l gpzfs1_1 -b1M -s3725G ada4\r\n<\/pre>\n<p>I then 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>I then copied back the original data that was on the single HGST Deskstar 4TB drive.  Since I had disabled TimeMachine on my desktop computer in order to move TimeMachine backups to the ZFS mirror, I re-enabled TimeMachine on my desktop and manually asked it to perform a backup.  It  worked fine and completed in less than 2 minutes since I hadn&#8217;t changed much on my desktop machine.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last night I installed an HGST Deskstar NAS 4TB drive in depot to pair with the existing HGST Deskstar 4TB drive. I saved the existing data to a ZFS pool on kiva, then wiped the existing HGST Deskstar drive: unmounted the filesystem, deleted the partition, deleted the partitioning scheme. If you&#8217;re doing this for the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.rfdm.com\/blog\/?p=752\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;depot&#8217;s backup space is now ZFS mirror&#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-752","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\/752","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=752"}],"version-history":[{"count":5,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/752\/revisions"}],"predecessor-version":[{"id":758,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/752\/revisions\/758"}],"wp:attachment":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}