Detaching a Volume from an Instance
You can detach a volume from an instance, which enables you to attach it to another instance and then access your data again.
Detaching a Volume from an Instance Using Cockpit v1
-
Click Storage > Volumes.
You can also select an instance in the Compute > Instances page and click Detach Volume(s) .
-
Click the volume you want to detach from the instance.
-
Detaching a volume on which data is being used or written may damage your resources.
-
You can detach the root device from an instance if this instance is stopped. However, you will not be able to restart this instance using this root device.
The volume is selected.
-
-
Click Detach .
A confirmation dialog box appears. -
Click Detach to validate.
The volume is detached from the instance.
Unlinking a Volume from a VM Using OSC CLI
See the UnlinkVolume command sample in the documentation of the OUTSCALE API. |
Detaching a Volume from an Instance Using AWS CLI
To detach a volume from an instance, use the detach-volume command following this syntax:
$ aws ec2 detach-volume \
--profile YOUR_PROFILE \
--volume-id vol-12345678 \
--endpoint https://fcu.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
volume-id
: The ID of the volume. -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
The detach-volume command returns a result as follows:
-
AttachTime
: The time at which the attachment was initiated. -
InstanceId
: The ID of the instance. -
VolumeId
: The ID of the volume. -
State
: The attachment state of the volume (attaching
|detaching
|attached
|detached
). -
Device
: The device name you specified when attaching the volume.
{
"AttachTime":"2016-02-05T13:56:48.970Z",
"InstanceId":"i-87654321",
"VolumeId":"vol-12345678",
"State":"detaching",
"Device":"/dev/xvdb"
}
The volume is detached from the instance and is now available.
Related Pages
Corresponding API Methods
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.