Eucalyptus EBS-backed Instances and Block Device Mapping

Follow

Eucalyptus Affected Versions: 3.1.0 and Greater

(Note: There are some bugs that are in the process of being fixed for 4.0 and beyond [1].)

Eucalyptus EBS-backed Instances and Block Device Mapping

Eucalyptus supports block device mapping concepts [2] per Amazon EC2.  EBS-backed instances these become particularly useful for users.  Namely support for the delete-on-terminate flag and growing the volume size.  This article explains how to use these two attributes with Eucalyptus EBS-backed instances.

Block device mapping attributes take the following form:

 -b /dev/sda1=<snapshot_id>:<volume_size_GB>:<delete-on-terminate-flag> 

Delete On Termination

When a EBS-backed instance is launched, an EBS volume is created from the registered snapshot.  This volume typically exists for the lifetime of the instance, until the instance is terminated.  A user wanting to run another instance based on the same image would get a fresh copy from the snapshot.  It is possible, through block device attribute, to set the behavior of a EBS-backed instance so that the volume is not deleted on termination.  This provides the practical benefit of saving changes to the instance and providing a failsafe, which is particularly useful when an instance must be terminated for cloud maintenance periods (such as platform upgrades).  Typically a user would use the euca-stop-instances and euca-start-instances commands against EBS-backed instances to ensure the instance state is saved.

To set the instance attribute to ensure the volume of the EBS-backed instance root filesystem is not deleted if the instance is terminate, use the following command when launching the instance:  

# euca-run-instances -k admin -g default -t m1.xlarge emi-6EBD3D78 -b /dev/sda1=::false

Changing Root Volume Size

Through another block device mapping attribute it is possible to alter the EBS volume size.  This can be useful for dynamically increasing the root volume based on application requirements.  To do this, pass the volume size to the mapping:

# euca-run-instances -k admin -g default -t m1.xlarge emi-6EBD3D78 -b /dev/sda1=:30:

The root volume will be set to 30GB when the instance is launched.   

Additional Notes

  • Attributes can be combined, thus it is possible to increase the root volume and set the delete-on-terminate flag.
  • Block device mappings can be specified with euca-register commands, this will serve the purpose of setting the attributes as default on the select EMI.  For example:

# euca-register -n myimage --kernel windows --root-device-name /dev/sda1 -b /dev/sda1=snap-C35240BB:50:false

References

[1] Eucalyptus Jira Dashboard - Possible Block Device Mapping Fixes for 4.0
[2] AWS EC2 User Guide - Block Device Mapping Concepts

Additional References

Have more questions? Submit a request

Comments

Powered by Zendesk