vSphere Linux VMs and best practice regarding OS disks

We are starting to move one VMWare environment to use Terraform for VM creation. What is the best practice for OS disks in this environment when guest is Linux?

We have a need to increase disk sizes every now and then, and it must be automated also. We are using Ansible for the actual OS + software configuration part.

Centos uses LVM by default for disk partitioning. I can clone our Linux template just fine to a new VM with Terraform, but the process for increasing disk size is a bit complex. And if we do it the same way as before, we have already two /dev/sdaX partitions for LVM root group when the machine is newly installed, and this doesn’t sound a best practice.

Current LVM disk size increase process

  • Make the vmdisk bigger
  • Add a new primary partition to /dev/sda
  • Add that partition to the LVM + assign to correct volume group etc.
  • Increase the size used by the filesystem

So, should we do it like this and then just increase the disk size in Terraform + create an automation to do the rest in Ansible?

In Azure things work much easier regarding this.