Attach and detach a volume
Attaching a volume lets you use it as a new disk, such as /dev/vdb, on one VM. The portal does the attach; you then format the disk once (create a file system on it) and mount it (make it appear as a folder, such as /mnt/data) inside the VM. Before you detach, you unmount it again so no data is lost.
When to attach, detach or move a volume
How it works
- Attach in the portal. The volume’s status goes Attaching → In Use, and the portal shows the device path.
- Format and mount inside the VM, using the Mount Instructions tab. Format only once, on a new volume.
- Unmount inside the VM, then Detach in the portal. The status returns to Ready.
Before you begin
- A volume with status Ready. See Create a volume.
- A Cloud VM or GPU VM in the same location as the volume.
- SSH access to a Linux VM, or Remote Desktop access to a Windows VM, with
sudoor Administrator rights. - Write access to the workspace (without it, Attach to Server isn’t shown).
Attach a volume
Open the volume
In the portal, open Block Storage and click the volume. On the Overview tab, an unattached volume shows Not attached to any server and an Attach to Server button.
Mount the volume on Linux
Open the volume’s Mount Instructions tab. It says Volume is attached — run these commands inside your server., with the kernel device (for example /dev/vdb) and a stable path such as /dev/disk/by-id/virtio-…. Use the stable path in the commands: unlike /dev/vdb, it doesn’t change when you attach more disks. (virtio is the virtual disk driver the VM uses.)
mkfs.ext4 erases everything on the volume. Run it only on a new, empty volume. Skip it for a volume that already has data, such as one moved from another VM.
SSH into the VM and run the commands from the tab. Here DEVICE is the stable path and /mnt/data the folder to mount it on:
nofail lets the VM boot even if the volume is detached later.
Verify
df -h /mnt/data shows the volume’s size on /mnt/data, for example:
Run sudo mount -a: no output means the /etc/fstab line is correct.
Mount the volume on Windows
For a Windows VM the tab reads Volume is attached — prepare it inside Windows. and shows Disk Management and PowerShell steps.
Initialize-Disk and Format-Volume erase everything on the disk. Run them only on a new, empty volume.
With Disk Management:
- Connect to the VM with Remote Desktop.
- Open Disk Management (or Server Manager → File and Storage Services → Disks).
- Bring the new disk online if it shows as offline.
- Initialize it as GPT (new, empty volumes only).
- Create a New Simple Volume, assign a drive letter, and format it as NTFS.
- Check the drive is Healthy and visible in File Explorer.
With PowerShell (as Administrator), new empty disk:
Disk that already has data:
Detach a volume
Always unmount the volume (Linux) or take the disk offline (Windows) before you detach it. Detaching a mounted volume can corrupt its file system and lose recent writes.
Unmount inside the VM
On Linux, run the Unmounting commands from the Mount Instructions tab:
On Windows, close programs using the drive, then in PowerShell as Administrator:
The volume keeps its data and its charge. You can attach it to any VM in the same location.
Use the API
With a platform API token:
- Attach:
POST /compute/cloud-vms/{vm_id}/actions/attach-volume(GPU VMs:/compute/gpu-vms/{vm_id}/actions/attach-volume) withvolume_idandbilling_catalog(thesku_idandsku_codeof the volume’s plan). - Detach: the matching
…/actions/detach-volumewithvolume_idand"confirm_unmounted": true, after you unmount the volume.
Limits
Troubleshooting
Related pages
- Create a volume: create, resize and delete
- Block Storage overview
- Cloud VMs
- Snapshots
