Basing this question on information I got in Why does df shows only half the size of a RAID10 array?, how should I create a RAID10 array using EBS volumes on Amazon, in a way that will not be redundant too much ?
As the linked question shows, I was using a guide from the 10gen company (that created mongodb) for how to create a raid10 array using EBS.
I encounter an issue with the size of the created array, and got the response that I should use a different approach for the LVM over MDADM usage of the script.
Since this is the first encounter with RAID at all for me, I can't seem to understand exactly the differences between what the script does, and the suggested way of LVM (nor do I understand how to do it).
I am a programmer and I consider myself very comfortable with linux machines which I've learned while trying to accomplish what I need to get done. Now arrived the time for me to know RAID installments.
Relevant information:
Instance is m1.large Ubuntu 11.10.
Here is the script from the linked question, for comfort reasons:
#!/bin/sh
disk1="/dev/xvdh1"
disk2="/dev/xvdh2"
disk3="/dev/xvdh3"
disk4="/dev/xvdh4"
echo "*** Verifying existence of 4 volumes $disk1, $disk2, $disk3 and $disk4"
if [ -b "$disk1" -a -b "$disk2" -a -b "$disk3" -a -b "$disk4" ]; then
echo "# Found expected block devices."
else
echo "!!! Did not find expected block devices. Error."
exit -1
fi
until read -p "??? - How big (in GB) are the disks (They should be the same size)? " disk_size && [ $disk_size ]; do
echo "Please enter a disk size."
done
lv_size=$(echo "scale=2; $disk_size * 2.0" | bc)
echo "*** Assuming a per disk size of $disk_size gigs, will create a logical volume of $lv_size gigs, with $lv_size reserved for snapshots"
echo "*** Partitioning disks..."
echo "~ Partitioning $disk1"
echo ',,L' | sfdisk $disk1
echo "~ Partitioning $disk2"
echo ',,L' | sfdisk $disk2
echo "~ Partitioning $disk3"
echo ',,L' | sfdisk $disk3
echo "~ Partitioning $disk4"
echo ',,L' | sfdisk $disk4
sleep 6
echo "*** Creating /dev/md0 as a RAID 10"
/sbin/mdadm /dev/md0 --create --level=10 --raid-devices=4 $disk1 $disk2 $disk3 $disk4
echo " ~ Allocating /dev/md0 as a physical volume."
/sbin/pvcreate /dev/md0
echo " ~ Allocating a Volume Group 'mongodb_vg'"
/sbin/vgcreate -s 64M mongodb_vg /dev/md0
echo " ~ Creating a Logical Volume 'mongodb_lv'"
num_extents=$(echo "$disk_size * 1024 / 64" | bc)
/sbin/lvcreate -l $num_extents -nmongodb_lv mongodb_vg
echo " ~ Formatting the new volume (/dev/mongodb_vg/mongodb_lv) with EXT4"
/sbin/mkfs.ext4 /dev/mongodb_vg/mongodb_lv
echo " ~ Done! Go ahead and mount the new filesystem. Suggested FStab: "
echo " /dev/mongodb_vg/mongodb_lv /data ext4 defaults,noatime 0 0"