Skip to content

Increase a compute instance's disk size

Disk size change can only happen up.

  1. Update the server entry's disk_size value (in the infrastructure repository), and apply the plan. This will enlarge the volume that is bound to the compute instance (usually mapped as a block device, /dev/sda). Once the plan is applied:
  2. determine which partition you want to let benefit from the block device size increase (usually /dev/sda1)
  3. logged into the instance as debian, enlarge that partition with (there is a space between /dev/sda and 1):
$ sudo growpart /dev/sda 1

it should answer with something like:

CHANGED: partition=1 start=262144 old: size=6029279 end=6291422 new: size=20709343 end=20971486
  1. then extend the filsystem using that partition with (there is no space between /dev/sda and 1):
$ sudo resize2fs /dev/sda1

it should answer with something like:

resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/sda1 is now 2588667 (4k) blocks long.
  1. Check that your procedure has worked:
$ df -h /dev/sda1

Enjoy.