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):(if it doesn’t work, try forcing with the param –force).
$ mdadm --create /dev/md1 --level=raid5 \
> --chunk=64 --parity=left-symmetric \
> --raid-devices=3 /dev/sdb1 /dev/sdb2 /dev/sdb3
Wait for the sync to finish. For monitoring the sync operation, keep an eye on /proc/mdstat with a simple cat:After synced, create the filesystem:
$ cat /proc/mdstat
(of course, you can create the filesystem of your choice here).
$ mkfs.ext3 -b 4096 -R stride=16 /dev/md1
Mount it:If you want to mount it at the boot:
$ 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
$ mdadm --detail --scan > /etc/mdadm/mdadm.confAdd a line to your /etc/fstab:
Please, note that all these commands must be run as root.
# <file system> <mount point> <type> <options> <dump> lt;pass>
/dev/md1 /path/where/you/wish/to/mount ext3 defaults 0 2
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!

December 9th, 2009 at 11:33
RAID and LVM on Amazon EC2 (part I) | DebianZone…
All about debian distorsThis is the first part of three articles I’m posting for a great storage solution using RAID, LVM and Amazon Elastic Block Store (EBS)….
December 10th, 2009 at 02:19
I don’t get it. Why do you need to raid ebs volumes if they’re already redundant?
December 10th, 2009 at 05:29
[...] http://debianzone.org/raid-and-lvm-on-amazon-ec2-part-i/ [...]
December 10th, 2009 at 08:48
EBS is already redundant within the same datacenter. Raid5 isn’t going to help you.
December 11th, 2009 at 17:33
@Tim, @rob: EBS is already redundant, but in a different scope.
The thing is that EBS volumes also fail. And if you rely on storing your data in a single volume and then someday your EBS is not available anymore, you’re lost.
Also, a RAID implementation, considering that EBS volumes fail (and they really do), will make sure your data is still there in case of a disk failure, volume unavailability, volume detached from the instance, or any other issue you may have with your volumes.
One more thing where RAID and LVM are pretty useful with Amazon EBS is they can break the limitation of 1TB of a single volume.
With RAID I can monitor the health of the disks, create snapshots of every disk in my array and, in case of fail, automatically create a new EBS volume, dynamically add to my RAID array, sync and have everything working normally again, without any stop in my storage.
July 22nd, 2010 at 01:20
Buy:Cialis Super Active+.Viagra Super Active+.Cialis.Cialis Soft Tabs.Viagra Professional.Viagra Soft Tabs.Viagra.Cialis Professional.Zithromax.Viagra Super Force.Tramadol.Propecia.Levitra.VPXL.Super Active ED Pack.Soma.Maxaman….