If you have used StableBit Drivepool in your system, you might have realized by now that it does not have a parity solution for data resilience. The ‘duplicate‘ feature might not be cost-effective for a home user as it takes half of the space to store a copy.
Here is where this Open Source tool SNAPRAID can help you achieve a parity based backup for your drive pool while retaining a lot of storage space for use. This tutorial will help to configure Snapraid parity with Stablebit DrivePool.
According to the developers, “SnapRAID is a backup program for disk arrays. It stores parity information of your data and it recovers from up to six disk failures. It is mainly targeted for a home media center, with a lot of big files that rarely change.”
This is not a real time parity generator, so I would not use it on high risk data systems. Parity computation is done ‘on demand’, whenever you issue a command to SnapRaid. We are going to see how to schedule it as a batch job in windows here.
Before installing the tool, make sure you have the below prerequisites.
- A drive pool with one or more drives. They are going to be the data disks in Snapraid’s terms.
- One or more disks for parity storage. This has to be at least as big as the largest drive in the drive pool. You can have more than one drive to increase the parity protection. Parity drives should not be used for storing data.
Steps to Configure SnapRaid
2. Next prepare the configuration file for Snapraid. Make a copy of the snapraid.conf.example file and rename it to snapraid.conf.
The file has many parts, but we will focus only on the first 4 configurations, which will get you going first.
3. The First section is for the parity storage location. Specify the drive mounting point and the parity file name in the format “parity FILE_PATH“
# Defines the file to use as parity storage parity C:\Drives\Drive4\snapraid.parity
4. The second section is for additional parity. You can add up to 6 additional parity storage locations here, like “n-parity FILE_PATH”. I am going to use one parity for my array though, I will comment them out later.
# Defines the files to use as additional parity storage. 2-parity C:\Drives\Drive5\snapraid.parity 3-parity C:\Drives\Drive6\snapraid.parity
5. The third section is for content list. You would need to add at least number of parity + 1 locations for the content files, in this format “content FILE_PATH”. I prefer to put them in all of my boot, parity and data disks. It is not going to take that much space anyway.
# Defines the files to use as content list content C:\snapraid\snapraid.content content C:\Drives\Drive1\snapraid.content content C:\Drives\Drive2\snapraid.content content C:\Drives\Drive4\snapraid.content
6. The fourth section is for the data disks. Add all the mount points of your disks with an identifying disk names in the front like “data DISK_NAME DISK_MOUNT_POINT”. You will use these disk names in the future to replace or repair your array.
# Defines the data disks to use data d1 C:\Drives\Drive1\ data d2 C:\Drives\Drive2\
7. That is it! You are now ready to run the parity generation process. Navigate to snapraid installation folder and run “snapraid.exe sync”
Since this is the first run it will create all necessary content and parity files. Upon completion, you will have a backup of your drive array in your parity drive.
How to restore if a disk fails?
I am going to simulate a disk failure by intentionally deleting the volume on Drive2 (C:/Drives/Drive2).
Following that, I will attempt to restore it to my spare disk Drive3 (C:/Drives/Drive3)
1. Disk2 is missing in the DrivePool
2. Change the corresponding drive name’s location to the new drive in the data disk section, of the snapraid.conf file. Here I changed d2 from “C:\Drives\Drive2\” to “C:\Drives\Drive3\”
# Defines the data disks to use data d1 C:\Drives\Drive1\ data d2 C:\Drives\Drive3\
3. Do the same for the content section.
# Defines the files to use as content list content C:\snapraid\snapraid.content content C:\Drives\Drive1\snapraid.content content C:\Drives\Drive3\snapraid.content content C:\Drives\Drive4\snapraid.content
4. Run “snapraid -d DISK_NAME -l fix.log fix” after the above changes are done.
5. Finally, go to the drivepool and remove the missing disk Drive2, followed by adding Drive3. Now you will have your drive pool back intact.
Now you have your drive pool restored back intact.
How to schedule it as a task in Windows?
1. Now, create a bat file named “runTask.bat” and add the “C:/snapraid/snapraid.exe sync” command in the installation folder
2. Go to Task Scheduler, and create a folder for your new task. I created one named “MyTask”
3. Click Create a Basic Task and give it a name.
4. Set the trigger as needed. I am going to run this task Daily.
5. Set Action as “Start a program”
6. Select previously created “runTask.bat” file as the Program, and enter the Snapraid installation folder “C:\snapraid\” in the Start in text box.
That’s it, Snapraid task is scheduled and it will run every day. You can test it quickly by clicking Run in the task actions.