Resizing a block volume¶
Note
Volumes can only be grown, not shrunk. Resizing grows the block device; you still need to grow the filesystem on the instance (see below) before the extra space becomes usable.
Resizing the OS volume¶
The OS (root) volume is resized live, exactly like any other volume. After you resize it from the console, the running instance sees the larger /dev/vda right away; then grow its filesystem as shown below. The OS volume is partitioned and uses ext4 by default, so follow the partitioned ext4 instructions with target vda.
Growing the filesystem¶
After the volume is resized, grow the filesystem on the instance so the new space is usable. This applies to every volume, including the OS volume.
Replace <TARGET> with the volume target, e.g. vda (OS volume) or vdb (an additional volume). Check with lsblk.
Instructions for EXT4 filesystem (default)¶
If partitioned (e.g. the OS volume, which is ext4 by default):
Warning
growpart takes the device and the partition number as two separate arguments: growpart /dev/vda 4. resize2fs then takes the partition path: resize2fs /dev/vda4.
If not partitioned:
Instructions for XFS filesystem¶
Same process as in instructions for ext4 filesystem default, but replace resize2fs with xfs_growfs:
# if partitioned
xfs_growfs /dev/<TARGET><PARTITION_NUMBER>
# if not partitioned
xfs_growfs /dev/<TARGET>
Useful commands¶
To check the volume size and whether it's partitioned, use:
To check the filesystem type use: