Extend a volume

Make a volume larger in the console, also while it's attached, and then grow the partition and the file system in the operating system.

Extend a volume when it needs more space. The cloud enlarges the volume, also while it's attached, and you then let the operating system use the new space. A volume can grow, but it can't shrink.

Before you begin

  • You need the Owner or Contributor role, or a custom role with Manage access to Block & Object Storage, on the subscription or on the project.
  • The volume's status must be Available or In use.
  • Decide on the final size. You can't make the volume smaller again.

Extend the volume

In the console, go to StorageVolumes, and select the volume.

Select Resize.

In New size (GB), enter the new size. It must be larger than the current size and at most 16,384 GB.

Select Resize.

When the extend finishes, the volume's page shows the new size. An attached volume stays attached and in use while it's extended.

A volume is billed for its provisioned size, so it costs more after the extend.

To extend a volume with the API, use POST/scopes/{scopeId}/storage/volumes/{volumeId}/actions/resize.

Grow the file system

The operating system doesn't use the new space by itself. After the extend, grow the partition, if the disk has one, and then the file system. The following commands are for Linux.

Find the disk and its partitions.

List block devices
lsblk

If the file system is on a partition, for example vdb1, grow the partition first.

Grow partition 1 of the disk
sudo growpart /dev/<device> 1

Skip this step when the file system is directly on the disk, as in Quickstart: Create and attach a volume.

Grow the file system.

ext4
sudo resize2fs /dev/<partition-or-device>
XFS
sudo xfs_growfs <mount-point>

Check the new size.

Show the file system size
df -h <mount-point>
  • <device>: the disk's name in lsblk, such as vdb.
  • <partition-or-device>: the partition, such as vdb1, or the disk when it has no partition.
  • <mount-point>: the directory where the file system is mounted, such as /mnt/data.

Rules

RuleDetails
New sizeLarger than the current size, and at most 16,384 GB.
Volume statusAvailable or In use.
ShrinkingNot possible. To use a smaller volume, create a new one and copy the data.

Troubleshooting

MessageCauseWhat to do
"sizeGb must be strictly greater than the current size"The new size isn't larger than the current size.Enter a larger size.
"volume must be AVAILABLE or IN_USE to resize"The volume is still being created or is in error.Wait until the volume is Available or In use.
df shows the old sizeThe file system wasn't grown.Grow the partition and the file system, as described above.

If the extend fails, the volume's Activity tab lists the failed operation with the reason.

On this page