Increase disk size in an established VirtualBox Centos VMs

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:

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


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

Just a software everything fighting battles against mostly myself, and gaining small victories lately.