Skip to main content
Last updated on

Detach a volume from a VM

Detaching a volume does not delete the data — it just separates the block device from the VM. The volume goes back to Available and can be attached to another VM.

Unmount inside the OS BEFORE detaching in the Portal

Detaching a mounted volume can hang I/O in the OS or lose unflushed writes. Always unmount in the OS first, then detach in the Portal.

Step 1. Unmount inside the OS

Linux

# 1. Check where the volume is mounted
mount | grep /dev/sdb

# 2. Sync and unmount
sudo sync
sudo umount /mnt/data

# 3. Remove the entry from /etc/fstab if you don't need it anymore
sudo nano /etc/fstab

If umount reports target is busy, find the process holding it open:

sudo lsof /mnt/data
sudo fuser -m /mnt/data

Windows

  1. Open Disk Management (diskmgmt.msc).
  2. Right-click the disk → Offline.
  3. Or right-click → Eject in File Explorer.

Step 2. Detach in the Portal

Go to Cloud Server → Volumes, click next to the volume → Detach from server.

Action menu on a volume with the Detach from server item

Confirm in the dialog.

Detach volume confirmation dialog

The volume goes back to Available. You can:

  • Attach it to another VM.
  • Keep it as cold storage.
  • Delete it if you no longer need it (deleting a volume deletes the data — there is no recovery).
System volumes cannot be detached

The system volume (the one with the OS) cannot be detached while the VM is running. To replace the system disk, use Rebuild from base image or create a new VM and migrate the data.

See also