1

I have an Ubuntu 16.04.3 LTS GCE instance. I increased system disk space (from 20 GB to 30 GB) but after GCE restart, if I run

df -h 

I still get 20GB on disk size.

In the past, on Ubuntu GCE Instances, after the instance restart, the System automatically saw new disk space.

Also in the documentation I read:

"Alternatively, instances that use most recent versions of Public Images can automatically resize their partitions and file systems after a system reboot. The SUSE Linux Enterprise Server (SLES) public images are the only images that do not support this feature."

So, what is the problem? What can I do to get the new space?

Andrea Zonzin
  • 1,124
  • 2
  • 11
  • 26
  • Check the console logs and review what is reported during reboot for the resize operation. I wrote an article on how Google resizes Debian. https://www.jhanley.com/google-cloud-debian-9-resize-root-file-system/ – John Hanley Apr 15 '19 at 18:23

1 Answers1

2

You can execute:

$ sudo lsblk
$ sudo resize2fs /dev/sda1 30G

If you receive the message:

The filesystem is already 5242619 (4k) blocks long. Nothing to do!

Sorry, I believe that you can't resize the disk using resize2fs.

So, I know two alternatives that you can follow.

Alternative 1 - Attach another one disk in the VM.

Alternative 2 - Create a new disk from a snapshot of the original disk. Steps to create a disk from a snapshot:

  1. Stop the machine (not necessary but it is safe)
  2. Take a snapshot
gcloud beta compute disks snapshot <disk_name> --project=<project_id> --snapshot-names=snapshot-1 --zone=<zone> --storage-location=us 
  1. Create a new machine from that snapshot
hkanjih
  • 1,271
  • 1
  • 11
  • 29