Resize Disk of an Openstack’s Instance

In my current job, we are using Openstack to test and deploy our projects locally. Last week, I got an email from my colleague, and he told me that he cannot install any software in his Openstack’s instance.

When I checked the instance using the following command:

df -h –total

I found out that its root disk is full. That is why, he cannot install any software. After taking help from my friend GOOGLE. I found the following article (https://access.redhat.com/solutions/2151971) to resize cinder volume of an Openstack instance. I followed the following steps:

  1. Stop the instance (nova stop <isntance id>)
  2. Reset state of the volume to available (cinder reset-state –state available <cinder volume id>)
  3. Extend volume size (cinder extend <cinder volume id> <size in GB>)
  4. Change the status of volume to in-use (cinder reset-state –state in-use <cinder volume id>)
  5. Start the instance (nova start <isntance id>)

After doing that, I was able to see disk size has increased but Ubuntu OS was still showing full disk. Then I found one more article (https://devops.ionos.com/tutorials/increase-the-size-of-a-linux-root-partition-without-rebooting/) to extend the root disk in Ubuntu OS. I did the following steps:

  1. Use fdisk utility on your root disk (fdisk /dev/vda)
  2. Delete your primary disk by pressing “d
  3. Recreate it using “n
  4. First sector, choose default
  5. Last sector, give maximum size using “+size
  6. Write the changes by pressing “w
  7. Now run “df -h –total” to see the effect