Skip to content

Resize disks

This guide shows you how to increase the size of a disk and extend the filesystem to use the additional space.

  • A disk attached to a VM
  • SSH access to the VM (for filesystem extension)

You can only increase a disk’s size — you can’t decrease it. You don’t need to stop the VM to resize the disk.

Terminal window
evroc compute disk update mydisk \
--size-amount=200 \
--size-unit=GB
Terminal window
curl -X PATCH https://api.evroc.com/compute/v1beta1/projects/{projectID}/regions/{regionName}/disks/mydisk \
-H "Content-Type: application/json" \
-d '{
"spec": {
"diskSize": {
"amount": 200,
"unit": "GB"
}
}
}'

After increasing the disk size, the block device is automatically larger. Verify this with lsblk:

Terminal window
lsblk

However, you must extend the partition and filesystem to use the new space.

  1. Extend the partition using growpart:
    Terminal window
    sudo growpart /dev/vdb 1
  2. Resize the filesystem:
    Terminal window
    sudo resize2fs /dev/vdb1
  1. Extend the partition using growpart:
    Terminal window
    sudo growpart /dev/vdb 1
  2. Grow the XFS filesystem:
    Terminal window
    sudo xfs_growfs /mnt/mydisk

Note: Replace /dev/vdb and /dev/vdb1 with your actual device and partition names. Use lsblk to confirm the correct device names.

Disk resizing works for:

  • Boot disks
  • Data disks (including hotswap-attached disks)