{"id":1055,"date":"2014-07-15T20:55:31","date_gmt":"2014-07-15T10:55:31","guid":{"rendered":"https:\/\/thedragon.kicks-ass.org\/?p=1055"},"modified":"2014-08-28T18:29:37","modified_gmt":"2014-08-28T08:29:37","slug":"zfs-on-linux","status":"publish","type":"post","link":"https:\/\/thedragon.kicks-ass.org\/?p=1055","title":{"rendered":"ZFS on Linux"},"content":{"rendered":"<p>I&#8217;ve been looking at <a title=\"ZFS on Linux\" href=\"https:\/\/pthree.org\/2012\/04\/17\/install-zfs-on-debian-gnulinux\/\">ZFS<\/a>\u00c2\u00a0on <a title=\"ZFS on Linux\" href=\"http:\/\/zfsonlinux.org\/\" target=\"_blank\">Linux<\/a>\u00c2\u00a0for some time now, mainly due to silent corruption on my EXT4 file-system. One of the big benefits for me is data\/meta checksums, on data corruption is fetched from parity, and a data scrub picks up large numbers of errors. One of implementation problems is that people recommend ECC memory. This is due to the chance that bad memory may corrupt the disk when doing a scrub of the data and the Checksums fail to match.<\/p>\n<p>Another feature that I hope to use is Autogrow, by replacing the existing disks with larger disks one-by-one, then resilvering the data across all the disks, when the last one is replaced, the new space becomes available to the pool. While its <a title=\"ZFS administration Guide\" href=\"http:\/\/docs.huihoo.com\/opensolaris\/solaris-zfs-administration-guide\/html\/index.html\" target=\"_blank\">a lot to get your head around<\/a>, <a title=\"Oracle Solaris ZFS Administration Guide \" href=\"http:\/\/docs.oracle.com\/cd\/E23823_01\/html\/819-5461\/preface-1.html#scrolltoc\" target=\"_blank\">ZFS (now owned by Oracle)<\/a> is very similar to WAFL on NetApp. So that makes it far easier for me to grasp.<\/p>\n<ul>\n<li>Use\u00c2\u00a0\/dev\/disk\/by-id\/ata-* convention <a title=\"Creating ZFS filesystem on Linux\" href=\"http:\/\/louwrentius.com\/creating-a-basic-zfs-file-system-on-linux.html\">when adding to the zpool<\/a><\/li>\n<li>Use <a title=\"ZFS Install\" href=\"https:\/\/calomel.org\/zfs_freebsd_root_install.html\">Whole Disk and ashift=12<\/a> for 4k blocks<\/li>\n<li>Use disk quantity&#8217;s of <a href=\"https:\/\/wiki.archlinux.org\/index.php\/Experimenting_with_ZFS#RAIDZ1\" target=\"_blank\">power of 2 plus parity<\/a><\/li>\n<li>set parameters such as autoexpand\/autoreplace on before they are needed<\/li>\n<li>create <a title=\"Create ZFS volumes on Ubuntu\" href=\"http:\/\/www.jamescoyle.net\/how-to\/478-create-a-zfs-volume-on-ubuntu\">subvolumes<\/a> on the pool for space and or quota management<\/li>\n<li>unmount any previous mountpoint before doing set mountpoint (its immediate)<\/li>\n<li>Align Partitions on 4k boundaries ie: python ((314574848*512)%4096) = 0 remainder<\/li>\n<\/ul>\n<p>For my new setup I plan to use 2 x 2TB, partitioned as follows<\/p>\n<ul>\n<li>Part1 &#8211; 100G &#8211; linux mirror (md0)\n<ul>\n<li>\/ (root\/boot) &#8211; 30G ext4<\/li>\n<li>\/var \u00c2\u00a0&#8211; 80G riserfs<\/li>\n<li>\/home\/media\/Videos\/PchMenu &#8211; 10G riserfs<\/li>\n<li>swap &#8211; 20G swap<\/li>\n<\/ul>\n<\/li>\n<li>Part2 &#8211; Remainder &#8211; ZFS mirror\n<ul>\n<li>rpool\/home<\/li>\n<li>rpool\/home\/photos<\/li>\n<li>rpool\/home\/camera<\/li>\n<li>rpool\/music<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>For my media I plan to use 3x4TB in raidz1 as follows<\/p>\n<ul>\n<li>Whole of disk\n<ul>\n<li>storage<\/li>\n<li>storage\/media<\/li>\n<li>storage\/backups<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><code>zpool create -o ashift=12 backup \/dev\/disk\/by-id\/ata-HGST_HDN724040ALE640_PK2334PBHE5JHR<\/code><\/p>\n<p>zpool create -o ashift=12 rpool\u00c2\u00a0mirror sda sdb<br \/>\nzpool set autoexpand=on rpool<br \/>\nzfs create rpool\/home<br \/>\nzfs create rpool\/home\/photos<br \/>\nzfs create rpool\/home\/camera<br \/>\nzfs create rpool\/music<br \/>\nzfs set canmount=noauto rpool<br \/>\nzfs set atime=off rpool<br \/>\nzfs set atime=on rpool\/home<br \/>\nzfs set relatime=on rpool\/home<br \/>\nzfs set atime=off rpool\/home\/photos<br \/>\nzfs set atime=off rpool\/home\/camera<br \/>\nzfs set mountpoint=\/home rpool\/home<br \/>\nzfs set quota=10G rpool\/home\/camera<br \/>\n#zfs set copies=2 rpool\/home\/photos<\/p>\n<p>zpool create -o ashift=12 storage\u00c2\u00a0raidz\u00c2\u00a0sdc sdd sde<br \/>\nzpool set autoexpand=on\u00c2\u00a0storage<br \/>\nzfs create storage\/media<br \/>\nzfs create storage\/backups<br \/>\nzfs create storage\/backups\/dad<br \/>\nzfs create storage\/backups\/dean<br \/>\nzfs set canmount=noauto storage<br \/>\nzfs set canmount=noauto storage\/backups<br \/>\nzfs set atime=off\u00c2\u00a0storage<br \/>\n#zpool set autoreplace=on storage<br \/>\n#zfs set sync=disabled\u00c2\u00a0storage<br \/>\n#zfs set compression=on documents<\/p>\n<p>You can put swap onto zfs, not sure if its wise though<br \/>\n<code><br \/>\n#sudo zfs create tank\/swap -V 2G -b 4K<br \/>\n#sudo mkswap -f \/dev\/tank\/swap<br \/>\n#sudo swapon \/dev\/tank\/swap<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been looking at ZFS\u00c2\u00a0on Linux\u00c2\u00a0for some time now, mainly due to silent corruption on my EXT4 file-system. One of the big benefits for me is data\/meta checksums, on data corruption is fetched from parity, and a data scrub picks &hellip; <a href=\"https:\/\/thedragon.kicks-ass.org\/?p=1055\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[9,4],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p20dKL-h1","_links":{"self":[{"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=\/wp\/v2\/posts\/1055"}],"collection":[{"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1055"}],"version-history":[{"count":18,"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=\/wp\/v2\/posts\/1055\/revisions"}],"predecessor-version":[{"id":1085,"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=\/wp\/v2\/posts\/1055\/revisions\/1085"}],"wp:attachment":[{"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thedragon.kicks-ass.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}