Detaching a Volume from a VM
You can detach a volume from a virtual machine (VM), which enables you to attach it to another VM and then access your data again.
Unlinking a Volume from a VM Using Cockpit v2
-
Click inside the Volumes dashboard to make checkboxes appear.
You can also select a VM in the VMs dashboard and click
Unlink Volume.
-
Check the box of the volume you want to unlink.
-
Unlinking a volume on which data is being used or written may damage your resources.
-
You can unlink the root device from a VM if this VM is stopped. However, you will not be able to restart this VM using this root device.
The volume is selected and an action menu appears.
-
-
Click
Unlink VM.
A confirmation dialog box appears. -
Click Unlink.
The volume is unlinked from the VM.
Detaching a Volume from an Instance Using Cockpit v1
Cockpit v1 is no longer fixed nor supported. Cockpit v1 is no longer available in the cloudgouv-eu-west-1 Region. For more information, see End-of-Life Policy. |
-
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
The UnlinkVolume command detaches a Block Storage Unit (BSU) volume from a virtual machine (VM).
To detach the root device of a VM, this VM must be stopped.
$ osc-cli api UnlinkVolume --profile "default" \
--VolumeId "vol-12345678"
This command contains the following attributes that you need to specify:
-
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
ForceUnlink
: (optional) Forces the detachment of the volume in case of previous failure. Important: This action may damage your data or file systems. -
VolumeId
: The ID of the volume you want to detach.
The UnlinkVolume command returns the following elements:
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
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.