How to configure SnapRAID 11.x on Ubuntu Server
NOTE: This guide has been written for Focal Fossa 20.04LTS but has also been tested on Xenial Xerus 16.04 LTS, Ubuntu Trusty Tahr 14.04LTS, Precise Pangolin 12.04 & Lucid Lynx 10.04 although it may work equally well on earlier versions of Ubuntu too.
A note about the storing of configuration files
Obviously I cannot show you exactly how you should configure SnapRAID to meet your requirements but you will nevertheless need a SnapRAID configuration file. There is a sample file in the SnapRAID folder. So, copy the file to the /etc folder and edit it to suit your requirements.
If you’re taking my advice about storing config files outside the OS then issue the following two commands:
cp /var/lib/snapraid/snapraid-11.5/snapraid.conf.example /media/WD40EFRX/RAIDMain/MyScripts/snapraid.conf
sudo ln -s /media/WD40EFRX/RAIDMain/MyScripts/snapraid.conf /etc/snapraid.conf
obviously substituting /media/WD40EFRX/RAIDMain/MyScripts/ above with the location of your scripts folder.
If you’re not following my config file advice then issue this one command instead:
sudo cp /var/lib/snapraid/snapraid-11.5/snapraid.conf.example /etc/snapraid.conf
Then issue the following command to edit the config file:
sudo vim /etc/snapraid.conf
Please see the SnapRAID website for configuration notes and examples.
For reference, here’s an extract of the relevant parts from my /etc/snapraid.conf file.
parity /media/ST4000VN_2/SNAPRaid_Parity
content /var/snapraid.content
content /media/HD403WI/content
content /media/HD404UI_1/content
content /media/WD4000FYPS/content
disk d1 /media/HD403WI/
disk d2 /media/HD404UI/
disk d3 /media/ST4000VN_1/
disk d4 /media/WD4000FYPS/
disk d5 /media/WD40EADS/
disk d6 /media/WD40EFRX/
exclude *.bak
exclude *.unrecoverable
exclude /tmp/
exclude /lost+found/
include /RAIDMain/
pool /media/SnapRaidPool/
From the above you can see the parity information will be stored in a file called /media/ST4000VN_2/SNAPRaid_Parity
I’ve told SnapRAID to create a “content” file on a few of my disks. The recommendation is you must have at least one copy for each parity file plus one more. Although the SnapRAID manual states that you can store the content file on the same disk as the parity file itself it is not a good idea to do so since it can lead to problems when your drives are nearly full as explained above. For reference, my “content” files are around 1GB in size.
For information, the “content” file is created automatically by SnapRAID so you must ensure that the user running SnapRAID (in my case me) has permission to create the file in that location. The same goes for the Parity file.
All my data drives have just a single partition and I have two root folders on each of them: Unprotected and RAIDMain. Everything I want RAID protected I put in RAIDMain and everything else I put in the Unprotected folder. For example, backups of other computers in my house go in the Unprotected folder. On the OS Drive I have a RAIDMain folder plus all the other system folders. None of my system folders are backed up. As you can see from the above include statement only the RAIDMain folders are included. SnapRAID offers great flexibility but I recommend you start off simple and then progress from there.
Scheduling SnapRAID
Now we have SnapRAID configured we need to schedule it to keep the SnapRAID parity up to date. See the Schedule SnapRAID guide.