Attach volumes
A volume is an extra disk from Block Storage that you plug into a VM. Inside the VM it appears next to the root disk (/dev/vda) as another device, such as /dev/vdc. Unlike the root disk, a volume isn’t tied to the VM: you can detach it and attach it to another VM, and it’s kept when the VM is deleted.
When to use a volume
The root disk that comes with the plan (50 GB to 400 GB) is fine for the operating system and apps. It’s deleted with the VM.
How it works
- You create a volume in the same location as the VM.
- You attach it from the Block Storage page. The VM sees a new, empty disk.
- The first time, you format it (create a filesystem) and mount it (give it a folder, such as
/mnt/data). - You add it to
/etc/fstabso it’s mounted again after every reboot.
Before you begin
- A Running Cloud VM or GPU VM.
- A Ready volume in the same location. See Create a volume.
- SSH access to the VM (or Remote Desktop for Windows).
- A volume is billed from creation until you delete it, whether it’s attached or not. See Block Storage.
Attach and mount a volume (Linux)
Attach it in the portal
Open Block Storage, click the volume, then Attach to Server. Pick the VM under Select Server and click Attach to Server. When it’s done, the volume shows In Use and the device path, for example Device: /dev/vdc. There’s no volume section on the VM’s own page; attaching always starts from Block Storage.
Find the new disk
Sign in to the VM and list its disks:
The new disk has no partitions and no mount point, for example vdc 10G disk. Use the device shown in the portal.
The volume’s Mount Instructions tab in Block Storage shows the same commands with your device filled in.
Attach and mount a volume (Windows)
- Attach the volume in Block Storage as above.
- In the VM, open Disk Management.
- Right-click the new disk, choose Online, then Initialize Disk (choose GPT for disks over 2 TB).
- Right-click the unallocated space, choose New Simple Volume, and follow the wizard to assign a drive letter and format it as NTFS.
Verify
After the VM is Running again, cat /mnt/data/test.txt prints ok, which shows the volume is mounted automatically.
Detach a volume
- Stop anything writing to the volume, then unmount it inside the VM:
sudo umount /mnt/data. - Remove its line from
/etc/fstab(or keepnofailon it). - On the volume’s page in Block Storage, click Detach.
The volume keeps its data and can be attached to any VM in the same location. Detaching without unmounting first can corrupt its filesystem.
Deleting a VM detaches its volumes automatically and keeps them.
Volumes in snapshots and backups
- Snapshots let you choose: Root volume only, All attached volumes, or Selective volumes. See Create a snapshot.
- Backups always include every volume attached when the backup runs. See Backups.
Restored volumes are attached to the target VM but not mounted. Use the Mount Instructions in the recovery point’s Details, and don’t format them.
