<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: The Nomad Code</title>
    <description>The latest articles on DEV Community by The Nomad Code (@thenomadcode).</description>
    <link>https://dev.to/thenomadcode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1024132%2Fa9b4ab03-a680-4fca-b3f6-fc3dc08661fb.png</url>
      <title>DEV Community: The Nomad Code</title>
      <link>https://dev.to/thenomadcode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thenomadcode"/>
    <language>en</language>
    <item>
      <title>(MergerFS + SnapRAID) is the new RAID 5</title>
      <dc:creator>The Nomad Code</dc:creator>
      <pubDate>Fri, 10 Feb 2023 07:57:07 +0000</pubDate>
      <link>https://dev.to/thenomadcode/mergerfs-snapraid-is-the-new-raid-5-3fe6</link>
      <guid>https://dev.to/thenomadcode/mergerfs-snapraid-is-the-new-raid-5-3fe6</guid>
      <description>&lt;p&gt;I am travelling a lot, and as you must know, travelling with external hard drives, is heavy, and mostly unsafe. If anything happens to your hard drive, you will lose all your precious travel memories. Google One and its Google Photo app are very good, but you cannot store your videos in full definition, and you have to pay a monthly fee. Not ideal when you want to store a massive quantity of 4K videos.&lt;/p&gt;

&lt;p&gt;Because of this, a few years ago I decided to set up my own Home Server, aka NAS. I used old components from my previous PC, and others were found second-hand. I prefer to save my money to travel. 🤑&lt;/p&gt;

&lt;p&gt;I use it mainly for storing my photos and video and my files. In this NAS I have one M2 SSD drive for the system and temporary files, and 4 disks of 2TB, in RAID5, which means that I had a failure tolerance of one drive and could use 6TB of storage. This was enough size for my usage, and it was accessible from everywhere, 24/7. The dream.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BAu2UZ0Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0mv12cs3vsp7v7aq0b22.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BAu2UZ0Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0mv12cs3vsp7v7aq0b22.png" alt="My Previous RAID configuration" width="880" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Until that one day when I could not access it. &lt;/em&gt;&lt;/strong&gt; 🤯&lt;/p&gt;

&lt;p&gt;I tried to recover the best I could, but between the fact that 2 drives were down, and LVM on top of it, because of a bad choice made a long time ago. That was impossible.&lt;/p&gt;

&lt;p&gt;What probably happened is that one day, a disk silently crashed. I was sure I set up email notifications, but I never received anything about it. The system continued working on 3 disks. Until a few days ago when a second disk crashed, and I lost it all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Changing the drives
&lt;/h2&gt;

&lt;p&gt;Anyway, it was time for me to grieve my lost data, and be grateful for the few was hanging on another computer or with still copy of it on an SD card.&lt;/p&gt;

&lt;p&gt;Then I put everything out and remove the 2 faulty drives. I had 2 x 12TB external hard drive laying around from when mining CHIA was a thing. I decided to use them so this repair will not cost me any additional money.&lt;/p&gt;

&lt;p&gt;As you realised by now, I have a heterogenous drive configuration :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;2x2TB&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2x12TB&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We could use it in RAID in a 2xRAID1 configuration, but we will lose half of the drives in capacity.&lt;/p&gt;

&lt;h2&gt;
  
  
  My thoughs about Raid solutions
&lt;/h2&gt;

&lt;p&gt;On Paper, Raid is a great system for a NAS. We are losing one or 2 drives' capacity, depending if we choose RAID5 or RAID6 in exchange for 1 or 2 drive failure tolerance.&lt;/p&gt;

&lt;p&gt;Every time you write a file in a RAID5 Array, every block of it is written in a different drive, with its parity information stored in the parity drive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mXd7oYF---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snbwmaycpkc3wvvwro1l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mXd7oYF---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snbwmaycpkc3wvvwro1l.png" alt="How RAID5 works" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if like me you are losing 2 drives, well you lose everything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Well, I assure you that when it is happening to you would love to be able to get back some data from the 2 last disks! Well with RAID you can't. &lt;/em&gt;&lt;/strong&gt; 😑&lt;/p&gt;

&lt;p&gt;Then RAID has some annoying limitations when you are on a budget :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Replacing disks is not trivial, you need to put your array in degraded state and rebuild it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All disks must be the same size or you will just lose space, so an upgrade can be pretty salty. 💸&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The solution I choose
&lt;/h2&gt;

&lt;p&gt;And If I was telling you that with two different software, you could have the same level of safety, with more advantages? MergerFS and SnapRAID are not related to each other but are very complementary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MergerFS&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;MergerFS is a simple tool that allows you to group your disks and make them appear as one. When you write a file to this group, by default the file is written on the disk with more available space, on all the branches where the relative path exists. I invite you to have a look at the extensive &lt;a href="https://github.com/trapexit/mergerfs/tree/2.34.1#policy-descriptions"&gt;list of policies&lt;/a&gt; to find the one that matches the best.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unlike RAID, the split is not made on the block level, but on the file level. That means that if you lose one disk because it is just temporarily offline, or dead, you still have access to the files that are on the others. When your lost disk is back online, the missing files will magically appear.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There are ways with a bit of scripting, to have an SSD cache of the recently used files (I won't cover this for now).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Downside: that also can bring slower read/write times, because the load is not spread across all the drives.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;SnapRAID&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;SnapRAID allows you to store parity data from other drives, on 1 or 2 drives to have the same disk failure tolerance as RAID 5 or RAID 6&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is stored in files, so if you change of hard drive, you just have to copy these parity files to the new one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can exclude some folders if you don't want to generate parity for them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Downside: The parity is not generated in real-time, you have to run a command to analyse the drives and create the parity data for the files you just added or modified.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By combining these 2, we will have a storage solution, similar to RAID, but that will allow you to recover some data even with more than 2 drives failure. Yes, the parity is not in real-time, so there is a risk that you can lose the files between the moment you add them, and the moment you launch a sync. But my home server is mainly to store non-critical files, not every second, so it will be enough for my usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting it up on my machine
&lt;/h2&gt;

&lt;p&gt;I have 4 drives, 2 x 2TB and 2 x 12 TB. It is recommended to use one of your biggest hard drives for SnapRAID parity data, so I will use one 12TB drive. So I will have :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;/mnt/data1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;/mnt/data2&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;/mnt/data3&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;/mnt/parity1&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y07lM-ZY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zoc3qnqlryox0y1vz09r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y07lM-ZY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zoc3qnqlryox0y1vz09r.png" alt="My new storage configuration" width="880" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Formating the drives and mounting them
&lt;/h3&gt;

&lt;p&gt;First, on all the storage drives, we will create a new empty partition with fdisk, and format them in XFS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# For my first drive&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;fdisk /dev/sda
&lt;span class="c"&gt;# Then use : &lt;/span&gt;
&lt;span class="c"&gt;# g : Create a new partition table&lt;/span&gt;
&lt;span class="c"&gt;# n : Create a new partition on your drive&lt;/span&gt;
&lt;span class="c"&gt;# w : Write the new table on the drive&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start over with all the other drives&lt;/p&gt;

&lt;p&gt;Then we format them all&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;mkfs.xfs /dev/sd&lt;span class="o"&gt;{&lt;/span&gt;a,b,c,d&lt;span class="o"&gt;}&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we will format them all :&lt;/p&gt;

&lt;p&gt;Then we will print the ids of the different drives with the &lt;code&gt;blkid&lt;/code&gt; command. We use these IDs to complete our /etc/fstab file. The goal of it is to mount automatically the drives on startup.&lt;/p&gt;

&lt;p&gt;In the end, my /etc/fstab looks like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# /etc/fstab: static file system information.&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# Use 'blkid' to print the universally unique identifier for a&lt;/span&gt;
&lt;span class="c"&gt;# device; this may be used with UUID= as a more robust way to name devices&lt;/span&gt;
&lt;span class="c"&gt;# that works even if disks are added and removed. See fstab(5).&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# &amp;lt;file system&amp;gt; &amp;lt;mount point&amp;gt;   &amp;lt;type&amp;gt;  &amp;lt;options&amp;gt;       &amp;lt;dump&amp;gt;  &amp;lt;pass&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;# / was on /dev/nvme0n1p2 during curtin installation&lt;/span&gt;
/dev/disk/by-uuid/b9da617f-0084-47ff-93ac-f53f91e8a838 / ext4 defaults 0 1
&lt;span class="c"&gt;# /boot/efi was on /dev/nvme0n1p1 during curtin installation&lt;/span&gt;
/dev/disk/by-uuid/BFA1-BF33 /boot/efi vfat defaults 0 1
/swap.img   none    swap    sw  0   0

&lt;span class="c"&gt;# Data drives&lt;/span&gt;
&lt;span class="nv"&gt;UUID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"a7005af1-e11f-4a49-8c32-47a19711d39f"&lt;/span&gt; /mnt/data1  xfs defaults    0   2
&lt;span class="nv"&gt;UUID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"99322a38-d6e1-45ab-96eb-21c10bbb621d"&lt;/span&gt; /mnt/data2  xfs defaults    0   2
&lt;span class="nv"&gt;UUID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"eedaa80f-e3a9-4b89-8412-c1eeba7a9077"&lt;/span&gt; /mnt/data3  xfs defaults    0   2

&lt;span class="c"&gt;# Parity drive&lt;/span&gt;
&lt;span class="nv"&gt;UUID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"77bbec02-1662-4953-83c3-8f5f7367b1f0"&lt;/span&gt; /mnt/parity1    xfs defaults    0   2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I save the file and create these folders and mount all the drives at once :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; /mnt/data&lt;span class="o"&gt;{&lt;/span&gt;1,2,3&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; /mnt/parity1
&lt;span class="nb"&gt;sudo &lt;/span&gt;mount &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok, we have our drives formatted and mounted!&lt;/p&gt;

&lt;h3&gt;
  
  
  MergerFS
&lt;/h3&gt;

&lt;p&gt;We install MergerFS with a simple command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;fuse mergerfs &lt;span class="c"&gt;# MergerFS rely on fuse&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Warning : on my Ubuntu 22.04 LTS, the package version is giving me the resonably outdated version 2.33.3-1 ( Actual version from the Github repo at the moment of writing this post : 2.34.1). If you want the latest bugfixes, install your package from &lt;/strong&gt; &lt;a href="https://github.com/trapexit/mergerfs/releases"&gt;&lt;strong&gt;GitHub releases&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We go back to our &lt;code&gt;/etc/fstab&lt;/code&gt; file and we are creating a new mount.&lt;/p&gt;

&lt;p&gt;Here I decided to group all the drives mounted in &lt;code&gt;/mnt/data*&lt;/code&gt; and the grouped drive should be accessible under &lt;code&gt;/mnt/pool&lt;/code&gt;. As I want the data that I create to be spread across the drives according to their percentage of free space, I choose the &lt;code&gt;pfrd&lt;/code&gt; policy. Feel free to choose another (see &lt;a href="https://github.com/trapexit/mergerfs/tree/2.34.1#policy-descriptions"&gt;Policies&lt;/a&gt;). For me the line I add looks like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#MergerFS&lt;/span&gt;
/mnt/data&lt;span class="k"&gt;*&lt;/span&gt;  /mnt/pool   fuse.mergerfs   allow_other,use_ino,cache.files&lt;span class="o"&gt;=&lt;/span&gt;partial,dropcacheonclose&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;,category.create&lt;span class="o"&gt;=&lt;/span&gt;pfrd  0   0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We create the directory &lt;code&gt;/mnt/pool&lt;/code&gt; and we mount everything again :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; /mnt/pool
&lt;span class="nb"&gt;sudo &lt;/span&gt;mount &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;span class="nb"&gt;sudo df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We check and you will see a new drive appeared, having the cumulated capacity of all the drives in the array! If you create one file in the pool mount, you will see it appear on one of your drives.&lt;/p&gt;

&lt;p&gt;Cool no? 😎&lt;/p&gt;

&lt;h3&gt;
  
  
  SnapRAID
&lt;/h3&gt;

&lt;p&gt;OK. We have one big drive, but not of the data in it is safe from one drive failing.&lt;/p&gt;

&lt;p&gt;First, we install SnapRAID easily with :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;snapraid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we will edit &lt;code&gt;/etc/snapraid.conf&lt;/code&gt; If this file does not exist, don't worry, what has to be inside is pretty simple and we can write it ourselves.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;We want to specify where to store the parity data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We want to specify which data disk to use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We want to give to SnapRAID some content files. The content files are like an index of your data. It does not take that much space, so more won't hurt. You can even add one content file on the boot drive.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can add exclusions for the folders or files you don't want to have the parity generated, to save resources and space, and sync faster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Last but not least, a little option I like to add, &lt;code&gt;autosave 100&lt;/code&gt; specify that during a synchronisation, every 100Gb, the state should be saved. In case of a crash, or whatever happens, this will be safe.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;My &lt;code&gt;/etc/snapraid.conf&lt;/code&gt; look like this at the end:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;parity /mnt/parity1/snapraid.parity
data d1 /mnt/data1/
data d2 /mnt/data2/
data d3 /mnt/data3/
content /home/thenomadcode/snapraid.content
content /mnt/data1/.snapraid.content
content /mnt/data2/.snapraid.content
content /mnt/data3/.snapraid.content
exclude /Backup/
exclude /tmp/
exclude *.bak
autosave 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can launch your first sync with &lt;code&gt;snapraid sync&lt;/code&gt; it is quite fast but it also can take a while depending on how much data you have. When this command completes, your data is now &lt;strong&gt;safe&lt;/strong&gt; 🎉.&lt;/p&gt;

&lt;h2&gt;
  
  
  Auto sync
&lt;/h2&gt;

&lt;p&gt;Wait a minute, my data is safe now, but if I add or modify my files?&lt;/p&gt;

&lt;p&gt;Indeed with snapRAID, nothing is running in the background. You have to launch the process manually. To sync it on regular basis, I used a script inspired by Zack Reed. This script was supposed to send an email when finished with a report.&lt;/p&gt;

&lt;p&gt;From experience, email is nice, but it needs a configuration. You need to use a mail provider like &lt;em&gt;Mailchimp&lt;/em&gt; or &lt;em&gt;Sendgrid&lt;/em&gt; to send your email reliably, or you can also use your own Gmail account with a bit of configuration. Personally, I prefer to have my mailbox as clean as possible, so would prefer another solution: &lt;em&gt;Sending a notification to a Slack channel.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Slack notifications
&lt;/h3&gt;

&lt;p&gt;To receive slack notifications, nothing more simple. Go to &lt;a href="https://api.slack.com"&gt;https://api.slack.com&lt;/a&gt;. From there click on "Create a new App". Then choose from scratch, enter a name for it, and a workspace, and click create.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NVwksSaa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyyr8ymfc65m0wwf1kl7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NVwksSaa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyyr8ymfc65m0wwf1kl7.png" alt="Create a new App in Slack" width="880" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then to be able to send notifications, go to Incoming Webhook. Active the feature, and click on the "Add a new webhook to your workspace" button. Then grant access for your app to one channel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C2GcA4PF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dzmyfcws79xcyrr6ow8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C2GcA4PF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dzmyfcws79xcyrr6ow8g.png" alt="Create a webhook in slack" width="880" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once this is done, you will be given an example of a webhook that you can call using curl.&lt;/p&gt;

&lt;p&gt;If you just copy-paste this into your terminal, you will receive it on slack directly! Perfect! 🔔&lt;/p&gt;

&lt;p&gt;Slack is always open because it is the way my main customer decided to work. So I find it handy to be able to receive this notification here. But feel free to use the app you want, Discord or Microsoft Teams (if you are into that) also have a webhooks feature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Automated parity script
&lt;/h3&gt;

&lt;p&gt;Now that this works, let's copy the script of Zack Reed that you can find &lt;a href="https://zackreed.me/updated-snapraid-sync-script/"&gt;here&lt;/a&gt;, and adapt it to send slack messages instead. You can find &lt;a href="https://gist.github.com/thenomadcode/678ddbbfe7042ca9e0b8ede763ad9405"&gt;my slack version on my gist right here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This script has several variables that you can modify to suit your needs better.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;DEL_THRESHOLD&lt;/code&gt; and &lt;code&gt;UP_THRESHOLD&lt;/code&gt; will allow you to track the number of deleted or updated files. If the number of those files is exceeding the threshold numbers, the script will stop and trigger an alert (with slack in my case). This is preventing the script to modify the existing parity in case of accidental deletions of files and can prevent encryption malware that would encrypt all your files. This way you should be able to recover your deleted or modified files to their original state. Set it as you want according to what you consider to be an unusual number.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;SYNC_WARN_THRESHOLD&lt;/code&gt; variable is here to force a synchronisation after a certain amount of warning generated by the Updated/deleted files thresholds. Imagine you are changing a lot of files on purpose and the &lt;code&gt;SYNC_WARN_THRESHOLD=1&lt;/code&gt;, you will receive an alert. As you know that you are the one responsible for all these changes, you can just ignore them. The next time the script run, it will sync everything because one warning was already emitted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can also set up some settings for the scrubbing, so you don't verify all your data each time you run the script, but a percentage of it, thanks to :&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;SCRUB_PERCENT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;20
&lt;span class="nv"&gt;SCRUB_AGE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Don't forget to set the &lt;code&gt;SLACK_WEBHOOK_URL&lt;/code&gt; to your webhook endpoint :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Slack&lt;/span&gt;
&lt;span class="nv"&gt;SLACK_WEBHOOK_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://hooks.slack.com/services/XXXXXXXX/XXXXXXX/XXXXXXXXXXXXXXXXXXXXXXX"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything set? Good, save the script, and make it executable. Launch it, just to see that everything works fine and that you receive the notification. 🔔&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Eil7cs42--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cyrkvf2jnrucltbwww40.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Eil7cs42--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cyrkvf2jnrucltbwww40.png" alt="Ding ! Notification Received !" width="880" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then you have one last decision to make: &lt;strong&gt;when to call this script&lt;/strong&gt;. Indeed, if you add a new file to your pool, it will be unprotected and you can lose it in case of a failure until the parity synchronisation is done. For my usage, I choose to call it once a night. I set up a cron task for that, and if I add a lot of pictures at once, I call it manually to feel safer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# m h  dom mon dow   command&lt;/span&gt;
0 3 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; /home/thenomadcode/scripts/snapsync.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But you can call it several times a day if you don't have that much data or if you consider that your data is more precious than mine. &lt;em&gt;Your Server, Your Rules.&lt;/em&gt; 😎&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We have now a real alternative to RAID systems. &lt;strong&gt;MergerFS&lt;/strong&gt; to see all your disks as one, and &lt;strong&gt;SnapRAID&lt;/strong&gt; to handle parity are &lt;strong&gt;working seamlessly together&lt;/strong&gt;. The parity is handled at the &lt;strong&gt;file level&lt;/strong&gt; and not at the block one, and it brings &lt;strong&gt;more simplicity&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If tomorrow's drive sizes increase and I want to replace my drives with bigger ones, I will just have to copy content over the new drive and make it mount at the same mount point as the old one. This is a &lt;strong&gt;game changer&lt;/strong&gt; compared to having to put your RAID array in a degraded state, and rebuild it, soliciting heavily CPU and all drives, with the possibility it can create a failure while doing it.&lt;/p&gt;

&lt;p&gt;If like me you just use your home server to store files from time to time, movies that you want to watch or content that you can re-download, this is more than enough! If you want to use this in a more intensive context, with a lot of critical files changing all the time that you can't afford to lose, then RAID is still the way to go.&lt;/p&gt;

</description>
      <category>mergerfs</category>
      <category>snapraid</category>
      <category>linux</category>
      <category>homeserver</category>
    </item>
  </channel>
</rss>
