Increase disk size in an established VirtualBox Centos VMs

Yiğit İrez
2 min readMay 12, 2021

--

Now, this is something supposedly easy right?

I’m recently in the process of setting up a local CI/CD pipeline and after finishing installation of harbor, I noticed I had 150MB of disk space left. No biggy right, lets increase the disk space as it says in VirtualBox documentation;

Open Virtual Media Manager,

And then choose a disk partition, and roll the slider around to get what you want.

If it were so easy

You have to actually see the disk space in centos first to expand to it. Hence, we have to download a tool from ubuntu called gparted: http://gparted.org/download.php

And then mount the .iso to our image storage, run as default with all default settings. Choose a language and type nothing else, just press enter.

Eventually you will come to this screen. Here you can change the partition by dragging the yellow area (mine is all yellow because I already did) and then by pressing the green tick that will become available. After that close the vm, unmount the iso and then restart.

Done? No.

When you restart you machine, have a look at the volumes. You should finally be able to see something like this.

vgdisplay -v

Finally!

Also this; Our actual Centos installed partition.

We need to expand this

So to expand our original partition. We use the following commands.

lvextend -l +100%FREE /dev/centos/root
xfs_growfs /dev/centos/root
yay

--

--

Yiğit İrez
Yiğit İrez

Written by Yiğit İrez

Let’s talk devops, automation and architectures, everyday, all day long. https://www.linkedin.com/in/yigitirez/

No responses yet