{"id":1476,"date":"2020-06-22T22:25:32","date_gmt":"2020-06-23T04:25:32","guid":{"rendered":"http:\/\/jaredrobinson.com\/blog\/?p=1476"},"modified":"2021-09-27T09:10:56","modified_gmt":"2021-09-27T15:10:56","slug":"ubuntu-20-04-btrfs-mirrored-drives","status":"publish","type":"post","link":"https:\/\/jaredrobinson.com\/blog\/ubuntu-20-04-btrfs-mirrored-drives\/","title":{"rendered":"Ubuntu 20.04 + btrfs + mirrored drives"},"content":{"rendered":"<p>I run a Linux machine at home. It&#8217;s mostly a server, although sometimes I use it as a desktop. I use it for SSH, samba, and I have apache hosting family photos. The photos sit on a secondary drive, and lately it manifest sector errors. Some of photos were no longer accessible.<\/p>\n<p>Fortunately, I have a backup on an external hard drive. Thank goodness for backups!<\/p>\n<p>I decided that it was time to upgrade to Ubuntu 20.04. This time, I wanted mirrored drives with a file system that detects <a href=\"https:\/\/www.enterprisestorageforum.com\/storage-management\/silent-data-corruption-the-backup-killer.html\">silent data corruption<\/a> <a href=\"https:\/\/changelog.complete.org\/archives\/9769-silent-data-corruption-is-real\">2<\/a>.<\/p>\n<p>I started with btrfs, partitioned my first drive and installed Ubuntu. But wait? Should I have chosen ZFS?<\/p>\n<p><a href=\"https:\/\/wiki.ubuntu.com\/ZFS\">ZFS<\/a> is a first class citizen in Ubuntu, and is reportedly rock solid. The documentation is good.<\/p>\n<p>In contrast, it takes some searching to find good btrfs documentation, and some of the documentation refers to scary features that might eat your data &#8212; not comforting. Yet Facebook uses btrfs, so that&#8217;s good, right? On the other hand, they have people whose job it is to use it for the right use cases, and configure it appropriately. I don&#8217;t.<\/p>\n<p>Oh, and there&#8217;s <a href=\"https:\/\/bcachefs.org\/\">bcachefs<\/a>! It sounds great, and is reportedly faster, more modern than btrfs or ZFS, and more reliable that btrfs. Unfortunately, it&#8217;s not part of most Linux distributions yet, nor is it feature complete. I&#8217;ll look forward to using it in three to five years.<\/p>\n<p>Ultimately, I chose btrfs because it doesn&#8217;t require that I dedicate the entire hard drive, and because I already had some momentum having started my install with it.<\/p>\n<p>I found the following guide to be helpful to set up btrfs in mirrored mode: <a href=\"https:\/\/work-work.work\/blog\/2018\/12\/01\/ubuntu-1804-btrfs.html\">https:\/\/work-work.work\/blog\/2018\/12\/01\/ubuntu-1804-btrfs.html<\/a><\/p>\n<p>Arch has good documentation for btrfs: <a href=\"https:\/\/wiki.archlinux.org\/index.php\/Btrfs\">https:\/\/wiki.archlinux.org\/index.php\/Btrfs<\/a><\/p>\n<p>Update Sept, 2021: <a href=\"https:\/\/arstechnica.com\/gadgets\/2021\/09\/examining-btrfs-linuxs-perpetually-half-finished-filesystem\/\">Ars Technica has a review of the many sharp edges (i.e. dangers) of using Btrfs<\/a>. Among other things, the author, Jim Salter, says:<\/p>\n<p style=\"padding-left: 40px;\">Btrfs&#8217; refusal to mount degraded,\u00a0<em>automatic<\/em>\u00a0mounting of stale disks, and lack of automatic stale disk repair\/recovery do not add up to a sane way to manage a &#8220;redundant&#8221; storage system.<\/p>\n<p>Regardless, it&#8217;s what I&#8217;ve been using, and the<em> data healing<\/em> part of btrfs reportedly works well. I&#8217;d rather <em>not<\/em> go through a &#8220;tortuous&#8221; recovery in a future day, but at least I&#8217;ve linked to the article, and will reference it when that day comes.<\/p>\n<hr \/>\n<p>Once Ubuntu was installed, it took hours to add missing packages, reconfigure software and restore from backup. Here&#8217;s some of what I installed:<\/p>\n<p>sudo apt-get install meld screen jhead socat apache2 zsh tree tcpdump zip xz-utils zsh vlc ffmpeg samba fail2ban mutt curl strace git ruby rsync python3-virtualenv fetchmail procmail postfix openssh-server netcat-openbsd lsof gwenview dnsutils dosfstools build-essential htop silversearcher-ag mailutils vim-gtk3 at fetchmail<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I run a Linux machine at home. It&#8217;s mostly a server, although sometimes I use it as a desktop. I use it for SSH, samba, and I have apache hosting family photos. The photos sit on a secondary drive, and lately it manifest sector errors. Some of photos were no longer accessible. Fortunately, I have &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/jaredrobinson.com\/blog\/ubuntu-20-04-btrfs-mirrored-drives\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Ubuntu 20.04 + btrfs + mirrored drives&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,17],"tags":[],"class_list":["post-1476","post","type-post","status-publish","format-standard","hentry","category-linux","category-tech"],"_links":{"self":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/1476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/comments?post=1476"}],"version-history":[{"count":5,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/1476\/revisions"}],"predecessor-version":[{"id":1532,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/1476\/revisions\/1532"}],"wp:attachment":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/media?parent=1476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/categories?post=1476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/tags?post=1476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}