Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to Digg

DetachVolume

Description

Detaches an Amazon EBS volume from an instance. For more information about Amazon EBS, go to Using Amazon Elastic Block Store in the Amazon Elastic Compute Cloud User Guide.

[Important]Important

Make sure to unmount any file systems on the device within your operating system before detaching the volume. Failure to unmount file systems, or otherwise properly release the device from use, can result in lost data and will corrupt the file system.

[Note]Note

If an Amazon EBS volume is the root device of an instance, it cannot be detached while the instance is in the "running" state. To detach the root volume, stop the instance first.

Request Parameters

NameDescriptionRequired

VolumeId

The ID of the volume.

Type: String

Default: None

Yes

InstanceId

The ID of the instance.

Type: String

Default: None

No

Device

The device name.

Type: String

Default: None

No

Force

Forces detachment if the previous detachment attempt did not occur cleanly (logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance will not have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.

Type: Boolean

Default: None

No

Response Elements

The elements in the following table are wrapped in a DetachVolumeResponse structure.

NameDescription

requestId

The ID of the request.

Type: xsd:string

volumeId

The ID of the volume.

Type: xsd:string

instanceId

The ID of the instance.

Type: xsd:string

device

The device as it is exposed to the instance.

Type: xsd:string

status

Attachment state.

Type: xsd:string

Valid Values: attaching | attached | detaching | detached

attachTime

Time stamp when the attachment initiated.

Type: xsd:dateTime

Examples

Example Request

This example detaches volume vol-4d826724.

https://ec2.amazonaws.com/?Action=DetachVolume
&VolumeId=vol-4d826724
&InstanceId=i-6058a509
&AUTHPARAMS

Example Response

<DetachVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2011-01-01/">
   <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
   <volumeId>vol-4d826724</volumeId>
   <instanceId>i-6058a509</instanceId>
   <device>/dev/sdh</device>
   <status>detaching</status>
   <attachTime>2008-05-08T11:51:50.000Z</attachTime>
</DetachVolumeResponse>