I created centos7 virtual machine. But when I go into the virtual machine, I see a capacity of root ( / ) about 4GB. How can I increase the capacity root ( / ) of virtual machines to 15GB?
Then the size of the disk is unchanged - i.e. cloud-init is not kicking in and growing it. I tried adding the cloud init config disk device and also the growpart stuff to cloud init config which I’ve seen but I have no luck in making this happen automatically and have to run the commands manually. My full profile is now:
That’s where the confusion comes from. In order to not have to install the agent manually and go through all those hoops you should use the images:ubuntu/focal image but that doesn’t include cloud-init
While the official ubuntu:focal images DO have cloud-init but not the agent.
(please correct the above if I’m wrong for posterity)
In any case - I will just run the commands - Can I rely on the root partition always being /dev/sda2 ?
Before using the resize2fs command, delete the second partition (/dev/sda2) through fdisk /dev/sda and create it again.
And you can use the command resize2fs /dev/sda2.
Hi Thomas, thank you for your tireless efforts here on the forums and elsewhere with this project. It doesn’t go unnoticed and I’m very thankful and appreciative of your work. It’s a very useful and reliable piece of software.
I’ve got a related question that I hope you can provide some clarity on:
Can you explain how the image from the repository gets “unpacked” into the disk image? I’ve been having some strange behavior when trying to expand the size of the VM and I think the issues lies with how this unpack mechanism works.
For example, is it simply dd’d the repository image onto the 10GiB QEMU disk?
Thanks so much, hopefully it makes sense to ask in this topic.
Sorry for using you as a rubber ducky but once organized my thoughts and described the issue I think I figured out where to look. For anyone else wondering, I believe it’s here:
It looks like we shell out to qemu-img calling it as qemu-img convert -f qcow2 -O raw along with some potential performance related parameters.
tl;dr the qcow2 image from the repository gets converted into the 10GiB file via qemu-img logic.
I’m going to do some more testing but I might have reproducible data corruption bug as a result of qemu-img logic gone awry that might be worth accounting for or fixing upstream.