Creating and Mounting an EBS Volume

Follow
Affected Versions: [All]

This is an introductory guide to creating and attach an EBS volume to your running instance.

 

Description

Volumes are created using the euca-create-volume command. With a default configuration (using iSCSI), this creates a logical volume on the storage controller (SC) and exports it using the iSCSI target daemon. The following example illustrates how to do this, by creating a 5GB volume in the defined avai lability zone:
 

[root@Pod-01 ~]# euca-describe-availability-zones 

AVAILABILITYZONE        Lab-01  192.168.35.11 arn:euca:eucalyptus:Lab-01:cluster:CC-Pod01/

 

[root@Pod-01 ~]# euca-create-volume -z Lab-01 -s 5

VOLUME  vol-BB6644E4    5       Lab-01  creating        2012-04-17T21:45:13.593Z

 

Next, run euca-describe-volumes to check the status of the volume.  The status should change to "available":
 

[root@Pod-01 ~]# euca-describe-volumes 

VOLUME  vol-BB6644E4     5              Lab-01  available       2012-04-17T21:45:13Z

 

Then, attach your volume to your instance:

[root@Pod-01 ~]# euca-attach-volume -i i-B1614240 -d /dev/sdc vol-BB6644E4
VOLUME  vol-BB6644E4 

 

 euca-describe-volumes will return the status of the volume, it should be marked as "in-use": 

 

[root@Pod-01 ~]# euca-describe-volumes  VOLUME  vol-BB6644E4     5              Lab-01  in-use  2012-04-17T21:45:13Z ATTACHMENT      vol-BB6644E4    i-B1614240      /dev/sdc       attached        2012-04-17T21:51:19Z


Log into the instance and check to see if the new volume has been detected.


root@ubuntu:/dev# fdisk -l /dev/sdc

 

Disk /dev/sdc: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x00000000

 

Disk /dev/sdc doesn't contain a valid partition table

 
 

Format the device for use:
 

root@ubuntu:/dev# mkfs -t ext3 /dev/sdc

mke2fs 1.41.4 (27-Jan-2009)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

327680 inodes, 1310720 blocks

65536 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=1342177280

40 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks: 

        32768, 98304, 163840, 229376, 294912, 819200, 884736

 

Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 22 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.



Make a directory, mount the device and verify.
 

root@ubuntu:/dev# mkdir /vol-01

root@ubuntu:/dev# mount /dev/sdc /vol-01

root@ubuntu:/dev# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1             986M  439M  497M  47% /

tmpfs                  71M     0   71M   0% /lib/init/rw

varrun                 71M   32K   71M   1% /var/run

varlock                71M     0   71M   0% /var/lock

udev                   71M   36K   71M   1% /dev

tmpfs                  71M     0   71M   0% /dev/shm

/dev/sda2             527M   17M  484M   4% /mnt

/dev/sdc             5.0G  139M  4.6G   3% /vol-01


The volume is ready to use
 


NOTE: For version 2.0, Be sure to un-mount and detach the volume before restarting or stopping the instance.
NOTE: For versions have a bug that prevents the /dev/sdb from working. Please use sdc and above.

Have more questions? Submit a request

Comments

Powered by Zendesk