RAID and LVM on Amazon EC2 (part I)

This is the first part of three articles I'm posting for a great storage solution using RAID, LVM and Amazon Elastic Block Store (EBS). First, you need to choose your RAID implementation. Personally, I prefer to use RAID 5 on Amazon EC2, combined with LVM2. For setting a RAID 5 up and running you will need to raise at least 3 EBS volumes and attach them to your instance (let’s say: sdb1, sdb2, sbd3). Using mdadm you will setup your RAID array (/dev/md1): $ mdadm --create /dev/md1 --level=raid5 \
> --chunk=64 --parity=left-symmetric \
> --raid-devices=3 /dev/sdb1 /dev/sdb2 /dev/sdb3
(if it doesn’t work, try forcing with the param --force). Wait for the sync to finish. For monitoring the sync operation, keep an eye on /proc/mdstat with a simple cat: $ cat /proc/mdstat After synced, create the filesystem: $ mkfs.ext3 -b 4096 -R stride=16 /dev/md1 (of course, you can create the filesystem of your choice here). Mount it: $ mkdir /path/where/you/wish/to/mount # this step is not required if you already have your path to mount the RAID $ mount –t ext3 /dev/md1 /path/where/you/wish/to/mount If you want to mount it at the boot:$ mdadm --detail --scan > /etc/mdadm/mdadm.conf Add a line to your /etc/fstab: # <file system> <mount point>                 <type>  <options> <dump>  lt;pass> /dev/md1        /path/where/you/wish/to/mount ext3    defaults 0       2 Please, note that all these commands must be run as root. Usually, at initialization mdadm can get confused when trying to scan your devices. Make sure you have a line “DEVICE” in the top of your / etc/mdadm/mdadm.conf and if it’s properly set. Not always the value “partitions” works fine, so try to be specific. Examples: DEVICE /dev/sdb[1-3] -- OR – DEVICE /dev/sdb1 /dev/sdbx  # where x is your device numberI hope these tips can be of some help. Soon, I'll be posting the next part, where I'll talk about LVM. Cheers!