How to create and attach a volume

Follow

Affected Versions: [All]


Brief example creating and attaching a volume to an instance.

Information that you may want before you get started

  • Running Instance Number
  • Availability zone
  • Unused target device 
  • How to log into the instance


Create Volume and attach to the instance

  • euca-describe-availability-zones
  • euca-create-volume --zone Lab-01 --size 10
  • euca-describe-instances
  • euca-attach-volume vol-5EF04266 -i i-96563F5C -d /dev/sdc


Format Label and Mount the device

  • Log into the target instance
  • -bash-3.2# ls -latr /dev   ( identify the newly attached device name at the end of the list. * )
  • -bash-3.2# mkdir /vol
  • -bash-3.2# mkfs -t ext3 /dev/vdd
  • -bash-3.2# e2label /dev/vdd /vol
  • -bash-3.2# mount -L /vol /vol
  • -bash-3.2# df -h
  • -bash-3.2# cd /vol
  • -bash-3.2# echo "Hello World - `date`" > test_file.txt
  • -bash-3.2# cat test_file.txt          Hello World - Mon Mar 26 11:50:15 EDT 2012

* Note, the device name rotates starting at sdb or vdb depending upon NC settings and increments up with successive connections.  Reference NC setting If "1", use Virtio for dynamic block volumes USE_VIRTIO_DISK="1"

Volume usage
  • Launch instance
  • Attach volume
  • From within the volume mount the volume using the label 
  • Unmount the volume **
  • Detach the volume **
  • Stop the instance
** Note, failure to unmount and detach the volume may result in corrupted data and may affect the volume such that it cannot be remounted later. Should this occur, take a snapshot of the failing volume, create a new volume from this snapshot and mount the new volume.
Have more questions? Submit a request

Comments

Powered by Zendesk