How to resize a volume in an instance on OpenStack?

check using volume from list

openstack volume list

set status to available to a volume

openstack volume set --state available [volume id]

resize the volume

openstack volume set --size 40 [volume id]

check size and status again

Openstack volume show [volume id]

status become in-use, size become 40. It's attached to /dev/vda.

However, login into the vm, use df -h check, didn't find /dev/vda.

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G  1.8G   19G   9% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           1.9G   17M  1.9G   1% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs           379M     0  379M   0% /run/user/1000

Why it doesn't change?


Solution 1:

Openstack just increases the physical disk size. You will need to use the operating system utilities to increase the disk space allocated to / for example.

Solution 2:

I had a similar issue, and it was not clear for me how to resize the partition if you use an openstack volume. This did it for me:

Start with unmounting sudo umount /dev/sdb

Then make the system aware of the new size:

sudo e2fsck -f /dev/sdb

After that you can resize the volume

sudo resize2fs /dev/sdb

Finally mount the volume and check if the new filesize is set

sudo mount /dev/sdb /mount_point
df -h

Solution 3:

I had exactly same issue. Than i found the solution, here's mine :

After you finally resize the Volume from Ceph (Like the question above)

Login to your VM

## Grow part (i.e resize root partition)
sudo growpart /dev/vda 1

## Check if already extend
lsblk

## Resize ‘/’ partition to fill all space
sudo resize2fs /dev/vda1

## (option) If your filesystem is XFS, it can be grown while mounted using the xfs_growfs command:

sudo xfs_growfs /

## Verify
sudo df -H

I wrote my prod case in here, https://nicolas.my.id/resize-root-volume-openstack-without-downtime/