Running Sandstorm From a Raid 1 Drive Array

The UI of my Sandstorm instance

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!

  1. Install mdadm, which can manage multiple disk fusion.
  2. After plugging in the drives, find what the device names are with sudo fdisk -l. Mine happened to be /dev/sda and /dev/sdb.
  3. 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.
  4. Now that the drives are fused, they need a filesystem. sudo mkfs -t ext4 /dev/md/store
  5. Now, we give them a place to live. sudo mkdir /mnt/store && sudo mount --source /dev/md/store --target /mnt/store.
  6. Finally, we want to make sure they mount at boot. a. Find the UUID with lsblk -o NAME,FSTYPE,UUID. md127 shows up with file system type ext4, under an sda and sdb with type linux_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 line UUID=SOME-UUID /mnt/store ext4 defaults 0 0.

With all that out of the way, the only remaining work is to move Sandstorm over.

  1. Stop sandstorm. sudo sysctl stop sandstorm.service
  2. sudo cp -R /opt/sandstorm /mnt/store/sandstorm
  3. sudo mv /opt/sandstorm /opt/sandstorm.old (just in case; can delete later)
  4. sudo ln -s /mnt/store/sandstorm /opt/sandstorm
  5. sudo sysctl start sandstorm.service

And we’re good! Service startup chases through the symlink and everything’s all wired up.

Comments