Remediating Storage Space Issue on Google Compute Engine Virtual Machine

Remediating Storage Space Issue on Google Compute Engine Virtual Machine

Question

A production database virtual machine on Google Compute Engine has an ext4-formatted persistent disk for data files.

The database is about to run out of storage space.

How can you remediate the problem with the least amount of downtime?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

A.

On Linux instances, connect to your instance and manually resize your partitions and file systems to use the additional disk space that you added.

Extend the file system on the disk or the partition to use the added space.

If you grew a partition on your disk, specify the partition.

If your disk does not have a partition table, specify only the disk ID.

sudo resize2fs /dev/[DISK_ID][PARTITION_NUMBER] where [DISK_ID] is the device name and [PARTITION_NUMBER] is the partition number for the device where you are resizing the file system.

https://cloud.google.com/compute/docs/disks/add-persistent-disk

The correct answer for this scenario would be option A: In the Cloud Platform Console, increase the size of the persistent disk and use the resize2fs command in Linux.

Explanation: When a production database virtual machine on Google Compute Engine runs out of storage space, the quickest and easiest way to remediate the problem is by increasing the size of the persistent disk. Ext4 is a file system that can be resized while still mounted, so it's possible to resize the partition while the virtual machine is still running.

Option A is the correct answer because it allows for the least amount of downtime. To implement this solution, you would follow these steps:

  1. Log in to the Cloud Platform Console.
  2. Navigate to the Compute Engine section.
  3. Identify the virtual machine that requires more storage space and select it.
  4. Under the "Boot disk and local disks" section, click on the Edit button.
  5. Increase the size of the persistent disk to the desired amount and click on the Save button.
  6. Connect to the virtual machine using SSH or the Google Cloud Console's web-based SSH client.
  7. Run the command "lsblk" to list the available disks and their sizes. This will show the current disk size and the new size after the resize.
  8. Run the command "sudo resize2fs /dev/<disk-name>" to resize the file system on the disk.
  9. Verify that the disk has been resized by running "df -h".

Option B involves shutting down the virtual machine, increasing the size of the persistent disk and then restarting the virtual machine. This solution would cause downtime for the database service and is not the best option.

Option C involves increasing the size of the persistent disk and verifying the new space with the fdisk command in Linux. While this solution would work, it's more complex than option A and requires downtime to be taken while checking and configuring the fdisk partitions.

Option D involves creating a new persistent disk, formatting and mounting it, and then configuring the database service to move the files to the new disk. This solution would require downtime and involves more steps than option A.

Option E involves creating a snapshot of the persistent disk and restoring it to a new, larger disk. This solution also requires downtime and involves more steps than option A. Additionally, it's worth noting that creating a snapshot is a good way to back up data, but it's not a reliable way to resize disks because it can cause downtime and be prone to data loss.