I have created a compute instance on google cloud with the help of Terraform. Also created a persistent disk and attached it with the instance created. After that, I mounted the volume on “/home/ubuntu” path. Recently was trying to upscale the attached disk size from terraform and it got upscaled successfully, although the mounted file system did not get updated from this and still shows the previous unchanged disk size. Verified this using “df -h” in the instance.
I need to know how I can upscale the mounted file system when upscaling the disk size.
I have tried adding “metadata.startup-script” in the instance block of terraform but it only runs once the instance is created the first time. I am adding “sudo xfs_growfs -d /home/ubuntu” this command to extend the file system and it works when I run this through the instance console but not from the terraform startup script argument I mentioned before.
Also need to avoid recreation of the instance to avoid downtime.