Resize disks
This guide shows you how to increase the size of a disk and extend the filesystem to use the additional space.
Prerequisites
Section titled “Prerequisites”- A disk attached to a VM
- SSH access to the VM (for filesystem extension)
Increase a disk’s size
Section titled “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
Section titled “Resize using the CLI”evroc compute disk update mydisk \ --size-amount=200 \ --size-unit=GBResize using the API
Section titled “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
Section titled “Extend the filesystem inside the VM”After increasing the disk size, the block device is automatically larger. Verify this with lsblk:
lsblkHowever, you must extend the partition and filesystem to use the new space.
For ext4 filesystems
Section titled “For ext4 filesystems”- Extend the partition using
growpart:Terminal window sudo growpart /dev/vdb 1 - Resize the filesystem:
Terminal window sudo resize2fs /dev/vdb1
For XFS filesystems
Section titled “For XFS filesystems”- Extend the partition using
growpart:Terminal window sudo growpart /dev/vdb 1 - Grow the XFS filesystem:
Terminal window 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?
Section titled “What disk types can be resized?”Disk resizing works for:
- Boot disks
- Data disks (including hotswap-attached disks)
Next steps
Section titled “Next steps”- Learn how to format and mount new disks
- Learn how to hotswap disk attachments