Skip to content

Create and attach disks

This guide shows you how to create boot disks and data disks, attach them to virtual machines, and manage them using the evroc CLI.

For information about disks and how they work, see Disks.

  • Access to an evroc organization and project
  • evroc CLI installed and configured

A boot disk contains an operating system image that a virtual machine boots from. You must specify a disk image when creating a boot disk. Run evroc compute diskimage list to see available images, or see Available disk images for a quick reference.

Terminal window
evroc compute disk create mybootdisk \
--zone=a \
--image=ubuntu.24-04.1

You can also create a boot disk from:

  • A snapshot. This is useful for restoring a VM from a previous state or creating multiple VMs with the same base configuration.
  • A custom disk image. This is useful when using a boot image outside the set provided by evroc

See Create a Disk in the API reference.

Data disks provide additional persistent storage for virtual machines. Data disks don’t require a disk image, but you must specify the disk size.

Terminal window
evroc compute disk create mydisk \
--zone=a \
--size-amount=5 \
--size-unit=GB

You can attach data disks to an existing virtual machine. The VM must be stopped before attaching or detaching disks.

Important: The disk and VM must be in the same zone.

Add a disk to an existing VM:

Terminal window
evroc compute virtualmachine update myvm --append --disk=mydisk

Stop the VM to apply the changes:

Terminal window
evroc compute virtualmachine update myvm --running=false

Wait for the VM to stop, then start it again:

Terminal window
evroc compute virtualmachine update myvm --running=true

You can detach data disks from a virtual machine. The VM must be stopped before detaching disks.

Important: Before detaching a disk, remove its entry from /etc/fstab on the VM to prevent boot errors.

To detach a disk, update the VM with a complete list of disks that excludes the disk you want to detach. For example, if your VM has disks mybootdisk, disk1, and disk2, and you want to detach disk2:

  1. Remove the disk entry from /etc/fstab on the VM

  2. Stop the VM:

    Terminal window
    evroc compute virtualmachine update myvm --running=false
  3. Update the VM with only the disks you want to keep:

    Terminal window
    evroc compute virtualmachine update myvm --disk=mybootdisk --boot-from=true --disk=disk1 --boot-from=false
  4. Start the VM:

    Terminal window
    evroc compute virtualmachine update myvm --running=true

List all disks in your project:

Terminal window
evroc compute disk list

Use evroc compute disk get <name> for detailed information about a specific disk.

See List Disks in the API reference.

Delete disks you no longer need. A disk must not be attached to any virtual machine before you can delete it.

Terminal window
evroc compute disk delete mydisk

See Delete a Disk in the API reference.