Monday, 8 July 2013

Eucalyptus 3.3 Tutorials- Working with Volumes

Eucalyptus 3.3 Tutorials
Working with Volumes

In this tutorial, we are going to create and attach Elastic Block Store Volumes (a.k.a EBS) using the Eucalyptus User Console and with Euca2ools, the Eucalyptus Command Line tools.


EBS (Elastic Block Store) Volumes are block-level storage devices that you can attach to instances running in your Eucalyptus cloud.

Any changes that you make to an attached EBS volume will persist after the instance is terminated.

You can create an EBS volume by using the Eucalyptus command line tools or by using the Eucalyptus user console and specifying the desired size (up to 10GB) and availability zone. Once you've created an EBS volume, you can attach it to any instance running in the same availability zone. 
NOTE: An EBS volume can only be attached to one running instance at a time, but you can attach multiple EBS volumes to a running instance.

Using User Console:
Firstly, log on to your User Console with the appropriate Credentials recorded in the earlier steps. 

Once done, select the "Storage" >> "Volumes"

This will bring up the "Volumes" Dashboard using which you can create new volumes. To get started, select "Create New Volume"

This will bring up the following dialog. In this, provide a suitable "Name" for your Volume along with a desired Volume "Size". You can optionally create volumes from pre-existing snapshots as well, but since we don't have any snapshots created, we will skip this step for the moment. Next important thing is to select the "Availability Zone" in which you wish to provision this Volume.

NOTE: Volumes can only extend within the same Availability Zone. You cannot attach a Volume belonging to a Availability Zone to an Instance belonging to a different avail zone.

Once filed in, select "Create Volume"

In just a few seconds, your Volume will now be provisioned for you. Make a note of the "Volume ID" as we will need it as a reference when we attach this volume to our running Instance.

Next, in the same dashboard view, select the option "More Actions" >> "Attach to Instance" as shown.

This brings up the following dialog. Here, provide your "Instance ID" as well as the "Mount Point" where you wish to attach this volume to. Note that here, the Volume ID is auto-populated. Once done, hit "Attach".

It takes sometime for the volume to get attached to your running instance. Once done, it will be displayed as follows.

Now that your Volume is successfully attached to your Instance, the rest is pretty straightforward. Login to your Instance as done in the previous steps using the Key Pair and run the following commands as a "root" user:

# fdisk -l

This will show you the newly added Volume. Now you need to format it and mount whatever file system you want to it.

First, we format the disk. I am not going to run through the commands here as they are pretty simple and I always use defaults.

# fdisk /dev/vdb 

Once formatted, we create a file system on top of it. you can use any file system you want. I go with either ext3 or ext4 usually.

# mkfs.ext4 /dev/vdb1

Once that's done, create a new mount point/ folder in your Instance and mount the newly formatted volume to it. You can now use this volume as you would use a normal disk drive.

NOTE: Why use Volumes? well to put it simple.. Volumes persist even after you terminate your instances. You can detach them and attach them to any instance you want, so long as they are residing in the same availability zone.

Using Euca2ools:

You can alternatively provision volumes using Eucalyptus Command Line utilities called as Euca2ools.

To create a Volume, we use "euca-create-volume"


euca-create-volume --zone <availability_zone> --size <in_GB>


euca-create-volume --zone CLUSTER01 --size 8

You can also use the command "euca-describe-volumes" to list the volumes and their state within your availability zone.

To attach the volume, we use "euca-attach-volume"


euca-attach--volume <volume_ID> -i <Instance_ID> -d <Device_Name>


euca-attach-volume vol-D8453DE5 -i i-014C4296 -d /dev/sdf

You can check the status of your Volume using the "euca-describe-volume" command. It should show the "state" as "attached".

The rest of the steps remain the same. Login to your Instance, use the root credentials and format the volume. Create a file system and mount the volume to a folder of your choice.

That's it to it!! In our next tutorial, we will be working with Snapshots.. so stay tuned for more!!

>> Eucalyptus 3.3 Tutorials: Working with Snapshots

1 comment :

Unknown said...

can we permanently attach volumes?

Post a Comment

Note: only a member of this blog may post a comment.