Skip to main content

Block storage

Overview

Block storage is persistent storage attached to a VM like a disk. Data is preserved when the VM is deleted, and the volume can be reattached to a different VM.

Block storage continues to be billed after VM deletion

Block storage attached to a VM is kept when the VM is deleted, and continues to be billed until you delete the volume yourself. Unneeded storage must be deleted manually.


Performance specs

MetricSpec
BandwidthUnder 170 GiB: up to 128 MiB/s · 170 GiB and above: up to 250 MiB/s
IOPS3 IOPS per 1 GiB of disk size · minimum 100, maximum 16,000 IOPS · 1 IOPS is up to 256 KiB
BurstUp to 3,000 IOPS sustained for 1,800 seconds

Creating block storage

  1. From the left menu Block Storage > Block Storage, click Create Block Storage.

  2. Configure the following:

    FieldDescription
    Block storage nameA recognizable name (1–256 characters)
    Storage size (GiB)Required capacity. Minimum 10 GiB, maximum 32,768 GiB (32 TiB). When creating from an image, must be at least the image's original size
    ZoneChoose the same zone as the VM
    Disk typeEmpty disk (data only) / Image (bootable OS disk) / Snapshot (restore from an existing snapshot)
    Disaster recoveryAutomatically replicate to another zone (higher rate)
  3. Click Create.

DR setting must match the VM

If a VM was created with DR, the block storage you attach must also have DR enabled (otherwise you'll see machineDrMismatch). Likewise, you can only attach standard block storage to a standard VM.


Growing an existing disk (resize)

Stop the VM before resizing

The volume can only be modified when the attached VM is in Ready (idle) or Stopped state.

  1. Stop the target VM.
  2. Pick the target volume in Block Storage.
  3. Click Edit.
  4. Increase the value for Storage size (GiB) (shrinking is not supported).
  5. Click Save and wait until the status becomes Ready.
  6. Start the VM again.
  7. After connecting, confirm the filesystem has been expanded.
df -h
# Check that /dev/vda1 has grown

The filesystem is expanded automatically after the restart.


Attaching an additional disk

You can attach data-only disks alongside the existing OS disk.

Stop the VM before doing this

Step 1: Create an empty block storage volume

Pick Empty disk as the disk type to create a data-only volume.

Step 2: Attach to the VM

  1. On the new volume's detail page, click Edit.
  2. Pick the target VM in the Attached machine ID field.
  3. Click Save.

Step 3: Start the VM and mount the disk

After the VM is running, connect over SSH and mount the disk.

# Check attached disks
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT

# Create a filesystem (first use only)
sudo mkfs.ext4 /dev/vdb

# Mount
sudo mkdir -p /data
sudo mount /dev/vdb /data

# Auto-mount on reboot
echo '/dev/vdb /data ext4 defaults 0 2' | sudo tee -a /etc/fstab

Backing up with snapshots

You can save a point-in-time copy of a block storage volume.

  • On the volume's detail page, click Create Snapshot.
  • Restore the data into a new volume, or attach the new volume to a different VM, by creating a block storage volume from the snapshot.

See Snapshots for details.


Next steps