1. Expand disk from GCP platform screen.
Select Platform Screen > [Compute Engine] > [Disks] > [Disk Detail]
When disk’s detail information was showed then click on [EDIT] button.

Change size and click on [SAVE] button

2. Execute Linux command Via Putty
Use SSH client to login to virtual machine, and execute command to setting.
The first check the file system.
Use SSH client (Putty) to connect to Compute Engine.
Root directory is mounting at [/dev/sda1]’s size is 10G.
Type of file system is importance to use which command to expand. In this time is ext4.
$ df -Th Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 286M 0 286M 0% /dev tmpfs tmpfs 60M 7.6M 52M 13% /run /dev/sda1 xfs 20G 1.7G 27G 6% / tmpfs tmpfs 297M 0 297M 0% /dev/shm tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs tmpfs 297M 0 297M 0% /sys/fs/cgroup
2-1. Expand Partition
Confirm current partition.
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 30G 0 disk └─sda1 8:1 0 20G 0 part /
sda1 is 20G.
$ sudo growpart /dev/sda 1 OR $ sudo growpart /dev/nvme0n1 1
If CHANGED: 〜 been showed then OK.
Elif sudo: growpart: command not found
$ yum install epel-release $ yum install --enablerepo=epel cloud-utils-growpart $ yum install --enablerepo=epel dracut-modules-growroot $ sudo growpart /dev/sda 1
2-2. Expand File system
If Linux’s File system are ext2/ext3/ext4/vfat then use resize2fs command, else XFS then use xfs_growfs command.
Expand File System: vfat
$ sudo resize2fs /dev/xvda1
$ sudo resize2fs /dev/nvme0n1p1
Expand File System: xfs
$ sudo xfs_growfs /dev/sda1
Check:
$ df -Th Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 286M 0 286M 0% /dev tmpfs tmpfs 60M 7.6M 52M 13% /run /dev/sda1 xfs 30G 1.7G 27G 6% / tmpfs tmpfs 297M 0 297M 0% /dev/shm tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs tmpfs 297M 0 297M 0% /sys/fs/cgroup
Check that [/dev/sda1」has been changed to 30G.