Sunday, May 28, 2017

Hardware RAID

The Pi does not have a SATA controller on board, and there is no way to attach extra
hard drives except via the USB ports. The cool thing is that you can get a USB RAID
controller. This makes file storage on the Pi a very attractive option. Technically, the
peripheral needed is called a USB SATA multiplier.

Configuration
There is no one-step guide to configure these multipliers. Some need to be configured
using software in Windows or Linux, while others may have DIP switches that
configure the multiplier to a specific configuration.
Addonics is a well-known and fairly easy-to-source multiplier. You will need to
search around on the Internet, online auctions, and shops for these. The prices are
around the same as the Pi; but if you are looking for redundant storage, then these
are the cheapest options you will find.

Massive storage
If you are looking to create a really massive storage, you can easily daisy chain a
multiplier with another, sometimes up to three or four times. Recently, Addonics
developed another device that can be daisy chained infinitely!

Let's assume that we can daisy chain up three levels and we use 2 TB hard drives.
We configure all the multipliers to span data across all drives with no redundancy;
that is, 5 times 5, times 5. We end up with 125 usable SATA ports and a total of 250
terabytes of storage. This figure is highly impractical for home users, because all
those hard drives consume a lot of power. There are people who have hard drive rigs
like these at home, so I would think using six multipliers to achieve 25 SATA ports
would be a completely viable and cheap option for some readers! The following
figure is a simple example of how to replicate 1 SATA port into 5 more Ports using
SATA port multipliers:


Redundant storage
We all have lost important data way too many times in our lives, and so you
should consider redundancy over massive storage. We can use a set of four 1 TB
hard drives that are configured in RAID 5 + S. This gives us 3 TB of usable space.
Also, if any one hard drive crashes, you can just replace it quickly and all the data
that we resynchronize will be stored without any loss. The following is a figure
explaining each feature of a SATA Port replicator:



Autostart

We need to create a startup script so that btsync will always run in the background.
Create a new file in /etc/init.d/btsync, and type in the following code. You need
to check the start directory and make sure that it's owned by the users that you used
while you were logged in.
#! /bin/sh
# /etc/init.d/btsync
#
# Carry out specific functions when asked to by the system
case "$1" in
start)
/home/root/.btsync/btsync
;;
stop)
killall btsync
;;
*)
echo "Usage: /etc/init.d/btsync {start|stop}"
exit 1
;;
esac
exit 0
Then, change the permission of the file and register it to run at boot.
sudo chmod 755 /etc/init.d/btsync
sudo /etc/init.d/btsync start # test that the script starts
sudo /etc/init.d/btsync stop # test that the script stops
sudo update-rc.d btsync defaults