Question

Difficulty: Very hardManaging Compute Engine Resources

Your operations team manages a critical stateful log processing database on an Ubuntu Linux Compute Engine virtual machine instance. Due to rapid data growth, the mounted ext4 data disk reached capacity. An administrator resized the persistent disk from 200 GB to 500 GB using the Google Cloud Console; however, running `df -h` inside the instance shows that the file system is still limited to 200 GB. Which set of actions must you perform to make the newly allocated 300 GB available to the operating system with minimal service disruption?

  1. Connect to the instance using SSH, run `growpart` to expand the target disk partition, and execute `resize2fs` to extend the ext4 file system online.Answer
  2. B
    Update the Compute Engine Managed Instance Group (MIG) autoscaling policy metric to monitor disk utilization percentage, expecting the MIG to automatically enlarge the existing disk partitions.
  3. C
    Unmount the persistent disk, change the disk provisioning model to a Spot persistent disk, and remount it to trigger automatic OS-level file system expansion.
  4. D
    Stop the VM instance and grant your user account the primitive Owner role on the GCP project to authorize the operating system to automatically resize mounted volumes upon reboot.

Answer

Connect to the instance via SSH, use `growpart` to expand the partition table, and use `resize2fs` to resize the ext4 file system online.
When a Compute Engine persistent disk size is increased in GCP, the hypervisor provides larger block storage, but the operating system's partition table and file system remain at their original sizes. To utilize the space online, administrators must connect to the VM via SSH, run `growpart` to expand the partition containing the file system, and then run `resize2fs` (for ext4 file systems) to grow the file system live.

Step-by-Step Solution

1
Understand GCP Persistent Disk expansion mechanics
Recognize that increasing disk size in GCP Cloud Console or gcloud updates the virtual block device size at the hypervisor level, but does not alter the guest OS partition table or file system.
Storage expansion in GCP is a two-step process: hypervisor disk resizing followed by operating system partition and file system resizing.
2
Identify the required Linux guest OS commands
Use `growpart` (or `parted`) to extend the partition to fill the newly available space on the block device, and `resize2fs` (for ext4) or `xfs_growfs` (for XFS) to extend the file system.
These standard Linux utilities allow online extension of mounted file systems without requiring VM reboots or downtime.

Key Concept

Compute Engine Persistent Disk Resizing and File System Extension
Rate this question