In our last guide, we discussed on how to create Cinder Volumes in OpenStack and attach them to running instance. This tutorial will cover how you can extend /grow the size of a Cinder volume.

Resize / Extend Cinder Volume in OpenStack from CLI

If you have configured OpenStack CLI, you can use it to to resize a Cinder volume. To make our guide complete, we’ll create a new volume.

$ openstack volume create --size 10 test-volume
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2019-11-03T20:29:56.000000           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | afec0c14-c5bb-42da-8f87-5a940ff18885 |
| migration_status    | None                                 |
| multiattach         | False                                |
| name                | test-volume                          |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 10                                   |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | None                                 |
| updated_at          | None                                 |
| user_id             | 336acbb7421f47f8be4891eabf0c9cc8     |
+---------------------+--------------------------------------+

Let’s attach it to an instance:

 $ openstack server add volume fed31 test-volume

Where:

  • fed31 is the name of the instance we’re attaching created volume
  • test-volume is the name of the volume

Confirm volume is attached to our VM.

[[email protected] ~]$ lsblk 
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    252:0    0  20G  0 disk 
└─vda1 252:1    0  20G  0 part /
vdb    252:32   0  10G  0 disk 

Then resize it and confirm the change inside a VM.

# Syntax
$ openstack volume set --size <size> <volume>

Where:

  • <size> is the volume size to extend in GB
  • <volume> is the volume to modify (name or ID)

But first unmount any partitions inside the instance if configured, then detach the volume.

# Inside VM unmount if mounted
# Then detach 

$ openstack server remove volume fed31 test-volume

I’ll extend the disk to 20 GB

 openstack volume set --size 20 test-volume

Re-attach it to the VM.

 $ openstack server add volume fed31 test-volume

Confirm new size:

$ lsblk 
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    252:0    0  20G  0 disk 
└─vda1 252:1    0  20G  0 part /
vdb    252:32   0  20G  0 disk 

More on OpenStack:

How To rename an Instance/Server in OpenStack

How To Resize OpenStack Instance / Virtual Machine

How To Set or update VM hostname in AWS / OpenStack / DigitalOcean

How To Create CentOS 8 KVM Image Template on OpenStack

How To Create OpenStack Instance With a Fixed / Static IP Address