Chapter 16. Provisioning Storage

Amazon Elastic Block Storage (EBS) is designed specifically for use with Amazon EC2 instances. Amazon EBS provides storage that behaves like a raw, unformatted, external block device. Red Hat supports 8 EBS volumes assembled into a software RAID 0 array for use as a single brick.

Important

Single EBS volume exhibits inconsistent I/O performance. Red Hat supported configuration is 8 Amazon EBS volumes of equal size on software RAID 0 (stripe) attached to a brick enables consistent I/O performance. You can create a brick ranging from 8 GB to 8 TB. For example, if you create a brick of 128 GB, you must create 8 Amazon EBS volumes of size 16 GB each and then create RAID 0 (stripe). Other configurations are not supported by Red Hat.
To add EBS volumes and provision storage
  1. Create an EBS volume using the following command:
    # ec2-create-volume -s SIZE -z ZONE
    For example,
    # ec2-create-volume -s 16 -z us-east-1a 
    vol-239289
    This command creates a volume of 16 GB and returns the volume ID.
  2. Use the generated volume ID to attach the created volume to an existing Red Hat Storage instance, using the following command:
    # ec2-attach-volume volumeid -i instanceid -d DEVICE
    For example,
    # ec2-attach-volume vol-239289 -i i-343833 -d /dev/sdf1
    The device /dev/sdf1 appears as /dev/xvdf1 in the instance.

    Important

    You must repeat the above steps to add remaining 7 Amazon EBS volumes to the existing instances.
  3. Amazon EBS volumes are assembled in to a RAID volume in support of configuration as a brick. Assemble software RAID 0 (stripe) using the following command:
    # mdadm --create arrayname --level=0 --raid-devices=8 list of all devices
    For example, to create a software raid of eight volumes
    # mdadm --create /dev/md0 --level=0 --raid-devices=8 /dev/xvdf1 /dev/xvdf2 /dev/xvdf3 /dev/xvdf4 /dev/xvdf5 /dev/xvdf6 /dev/xvdf7 /dev/xvdf8
    # mdadm --examine --scan > /etc/mdadm.conf
  4. Tag the attached EBS volumes using the following command:
    ec2-create-tags VOLID \
    --tag Domain=gluster \
    --tag Device=DEVICE \
    --tag Instance=INSTANCE_ID \
    --tag Array=UUID

    Table 16.1. Field Description

    Variable Description
    VOLID EBS volume ID
    DEVICE Device path of the EBS volume in the instance
    INSTANCE_ID Instance Id to which the volume is attached
    UUID UUID of the array device. You can obtain the UUID of the array device by running # mdadm --detail DEVICE | grep UUID command.

    For example, to tag /dev/xvdf1 device, run the following command:
    # ec2-create-tags vol-239289 \
     --tag Domain=gluster \
     --tag Device=/dev/xvdf1 \
     --tag Instance=i-343833 \
     --tag Array=e35641fc:621a9fa8:276a0ee4:a1bc6b5f
    Repeat Step 4 to tag all eight EBS volumes.
  5. Create a LVM Logical Volume (LV) by running the following commands:
    # pvcreate /dev/md0
    # vgcreate glustervg /dev/md0
    # vgchange -a y glustervg
    # lvcreate -a y -l 100%VG -n glusterlv glustervg
    Here glustervg is the name of the volume group and glusterlv is the name of the logical volume. This LVM logical volume created over EBS RAID volumes is used as Red Hat Storage bricks.
  6. Format the LVM LV using the following command:
    # mkfs.xfs -i size=512 DEVICE
    For example, to format /dev/glustervg/glusterlv run the following command:
    # mkfs.xfs -i size=512 /dev/glustervg/glusterlv
  7. Mount the device using the following commands:
    # mkdir -p /export/glusterlv
    # mount /dev/glustervg/glusterlv /export/glusterlv
  8. Add the device entry to /etc/fstab to mount the device automatically on every reboot. Run the following command to automatically add the device entry to fstab
    # echo "/dev/glustervg/glusterlv  /export/glusterlv  xfs  defaults  0  2" >> /etc/fstab
After you provision the storage, you can now use the mount point as brick with existing volumes or create new volumes. For more information on creating volumes, see Chapter 8, Setting up Red Hat Storage Volumes