Running Sandstorm From a Raid 1 Drive Array

In my quest to back slowly towards the exits from total reliance on Google’s infrastructure, I’ve managed to stand up an instance of Sandstorm on a small ZimaBoard. This has been successful; one thing I was very concerned about was storage reliability because I know if I’m rotating away from someone else’s Cloud, it’s up to me whether I lose data if these drives break. To that end, I put both two Seagate 2TB drives in a CENMATE 2-drive SATA enclosure and went about setting up a RAID-1.
The process is pretty straightforward!
- Install
mdadm, which can manage multiple disk fusion. - After plugging in the drives, find what the device names are with
sudo fdisk -l. Mine happened to be/dev/sdaand/dev/sdb. - Fuse them:
sudo mdadm --create /dev/md/store /dev/sda /dev/sdb --level=1 --raid-devices=2. This created/dev/md/store, which symlinks to/dev/md/127. - Now that the drives are fused, they need a filesystem.
sudo mkfs -t ext4 /dev/md/store - Now, we give them a place to live.
sudo mkdir /mnt/store && sudo mount --source /dev/md/store --target /mnt/store. - Finally, we want to make sure they mount at boot.
a. Find the UUID with
lsblk -o NAME,FSTYPE,UUID.md127shows up with file system typeext4, under an sda and sdb with typelinux_raid_member. The UUID is listed here, and they are the same. b. Back up the /etc/fstab file, then edit it to add the lineUUID=SOME-UUID /mnt/store ext4 defaults 0 0.
With all that out of the way, the only remaining work is to move Sandstorm over.
- Stop sandstorm.
sudo sysctl stop sandstorm.service sudo cp -R /opt/sandstorm /mnt/store/sandstormsudo mv /opt/sandstorm /opt/sandstorm.old(just in case; can delete later)sudo ln -s /mnt/store/sandstorm /opt/sandstormsudo sysctl start sandstorm.service
And we’re good! Service startup chases through the symlink and everything’s all wired up.
Comments