Clustering Porticor-Protected Storage for Linux Clients
Once you have created a secured disk on Porticor, it is almost
trivial to build a highly-available RAID solution on top of it. We
will demonstrate a RAID level 1 (mirrored) solution, but it can
easily be extended to more sophisticated RAID levels.
- Create a disk, and expose it as an iSCSI target.
- Go to the Virtual Appliances page, and create a second appliance in the same project.
- Navigate to the second appliance, and create another iSCSI disk of the same size.
- Mount both of these disks on your application server. Look up the Use It link for the particular disk for details on mounting it. Do not format the disks, only go as far as discovery and iSCSI login (the first two commands).
sudo iscsiadm --mode node ... -o new
sudo iscsiadm --mode node ... --login
- Check out the main mount points (e.g. /dev/sdc) that were created for the disks:
ls -l /dev/disk/by-path
- Now run (change the disk names as appropriate):
sudo mdadm --create --verbose --level=1 /dev/md0 -n 2 /dev/sdc /dev/sdd
- Normally, this configuration should persist across reboots. If it doesn't, make sure to add the following line to a startup script that runs late in the boot process, when remote filesystems have been mounted. Typically, /etc/rc.local should be that script.
mdadm --assemble --scan
- To verify that things are working fine, run
sudo mdadm --detail /dev/md0
- You should see the two disks listed, with the RAID synchronizing between the two ("state: resynching").
- To use your new, highly available storage, simply format /dev/md0 (use mkfs) and mount it, as you would a regular disk. Note that reconnecting to iSCSI might add a significant delay to the boot sequence, to the tune of 2-3 minutes.
If any of the disks should fail (this sometimes happens after reboot), see this Knowledge Base article to resolve this issue.
Final comments: these instructions were tested on Ubuntu 11.04 and on Amazon Linux, but mdadm is common across all major Linux distributions. For further reading on RAID and its Linux implementation, see this three-article series.