Steps
Get the disk’s device ID or the filesystem’s mount tag
- Web console
- CLI
- In the sidebar, go to
Storage → Disks or
Storage → Shared filesystems.
- Copy the device ID from the list of disks or the mount tag from the list of filesystems.
Make sure that the VM does not mount the volume when the VM restarts
- Connect to the VM over SSH.
-
Switch to the
rootuser: -
If you want to detach a secondary disk, get its UUID:
In this example, we assume that you have named the device
disk-0; for disks, all device IDs are prefixed withvirtio-. -
Open
/etc/fstabwith your preferred text editor, for example,nano /etc/fstab, and delete the lines that refer to the volumes:-
The line for a disk should start with its UUID:
-
The line for a filesystem should start with the filesystem’s mount tag from the VM specification:
In this example, the filesystem has the mount tag
filesystem-0and is mounted at/mnt/fs.
-
The line for a disk should start with its UUID:
- Disconnect from the VM.
Remove the volume from the VM’s specification
- Web console
- CLI
-
In the sidebar, go to
Compute → Virtual machines.
- Open the page of the required VM.
-
Click
Stop VM and then confirm it.
You can detach a disk from a running VM, but this can cause data loss or corruption. -
After the VM’s status becomes
Stopped, switch to the Disks or Filesystems tab. -
Next to the disk or filesystem, click
→ Detach.
-
After the volume is detached, click
Start VM and then confirm it.