Note: Please go to to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Clouds > AWS > Tutorials > Detach an EBS Volume from an instance

Detach an EBS Volume from an instance


A running instance with an attached EBS volume


You must use caution when detaching an EBS volume from a running instance in order to ensure that no data is lost or corrupted.   How you detach a volume will depend largely on the function of the volume.  For example, if you are performing writes to the volume (i.e database or sys-log server), it's imperative that you freeze the file system before detaching the volume.   However, if the volume is storing static data, freezing the file system may not be necessary.

By default, when an instance is terminated, any attached volumes will automatically become "detached" from the running instance.

As a best practice, you'll always want to create one last snapshot of a volume if you plan to delete it.   You can either take the snapshot before you detach the volume or after it's been detached.   If you are using Servers that were launched using one of RightScale's published "MySQL EBS" ServerTemplates, volumes will automatically be detached and deleted.  Therefore, if you want to create one last snapshot before you detach (and possibly delete the volume), you should take one last backup EBS snapshot. 

How you take the final snapshot will largely depend on how the volume is currently being used.

  • If you have a running instance where some application is writing data to the volume, you must first freeze the filesystem and then take the snapshot in order to ensure that no data is lost or corrupted.  In such cases, you should ONLY take a snapshot by running the "EBS volume backup" script from the "EBS Toolbox" ServerTemplate.  This script will perform an XFS freeze on the filesystem and then take a snapshot.  Once the snapshot is 100% complete, you can safely detach the volume.  DO NOT create a snapshot of the volume by using the Snapshot action button from the volume's page because it will not stop writes to the volume prior to the snapshot being taken, which may result in lost or corrupt data.
  • If no data is being written to the volume, you can either follow the same steps as above or detach it at either the Server or Volume level.  (see below)  If a volume is detached, you can safely use the Snapshot action button at the Volume level. (Clouds -> AWS Region -> EBS Volumes -> Select Volume)


Before you Detach an EBS Volume

  1. Freeze the volume (if supported by the file system)
  2. Make sure that all files are closed and that there are no pending writes to the disk.


Manually detaching an EBS Volume

There are two different ways you can detach an EBS Volume from a running instance:

  1. Detach at the Server Level
  2. Detach at the Volume Level


Detach at the Server Level

To detach an EBS Volume from an instance, go to the Volumes tab of an instance and click the Detach button and confirm the action.



Detach at the Volume Level

Under Clouds -> AWS Region -> EBS Volumes, click on the Detach button of a volume. 

You can also click the Detach button from the homepage of a selected volume.


You must to post a comment.
Last modified
16:45, 21 May 2013



This page has no classifications.



© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.