Resize disks
This guide shows you how to increase the size of a disk and extend the filesystem to use the additional space.
Prerequisites
- A disk attached to a VM
- SSH access to the VM (for filesystem extension)
Increase a disk's size
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.
Resize using the CLI
evroc compute disk update mydisk \
--size-amount=200 \
--size-unit=GB
Resize using the API
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"
}
}
}'
Extend the filesystem inside the VM
After increasing the disk size, the block device is automatically larger. Verify this with lsblk:
lsblk
However, you must extend the partition and filesystem to use the new space.
For ext4 filesystems
- Extend the partition using
growpart:sudo growpart /dev/vdb 1 - Resize the filesystem:
sudo resize2fs /dev/vdb1
For XFS filesystems
- Extend the partition using
growpart:sudo growpart /dev/vdb 1 - Grow the XFS filesystem:
sudo xfs_growfs /mnt/mydisk
Note: Replace
/dev/vdband/dev/vdb1with your actual device and partition names. Uselsblkto confirm the correct device names.
What disk types can be resized?
Disk resizing works for:
- Boot disks
- Data disks (including hotswap-attached disks)
Next steps
- Learn how to format and mount new disks
- Learn how to hotswap disk attachments