This method allows you to simply expand your diskspace on a Ubuntu VM (only tested on ubuntu 18.04 LTS). Note that you can only expand your diskspace but not shrink it!

How to do it

First of all you have to navigate to Compute Engine at the sidebar, Disks. This should open a list of all disks you have created in this project.

Select the disk you want to expand (make sure it is the right one under the in use by tag).

Here you can see f.e. details like Sustained throuhput limit wich scales linear with the size of the disk. To expand the disk space just select Edit at the top right. Then you should be able to enter a new number of GiB under the size tag.

When you are ready, scroll down, click save and navigate to VM Instances. There you need to click on the free dots besides the SSH- Connect Button and select Stop. When the instance has been successfully stopped you just need to start it again and connect to it via SSH. If you now type lsblk into the shell and hit enter you should see something like this:

The important part is this one:

The sda1 partition should now be updated to the new disk-size. In my example I expanded the disk to 40GB. If you use Perforce you can now control the disk-space also with P4Admin.

This site runs on a f2-micro instance on GCP

Google Cloud Platform