How to Increase the Size of the Root Disk in Google Compute Engine

To increase the size of the persistent disk(root disk) in the Google Cloud Platform Console:

  1. Click on Compute Engine product tab.
  2. Select Disks under the “Storage” section.
  3. Click on the name of the disk that you want to resize to get to the disk details page.
  4. At the top of the disk details page, click “Edit”.
  5. In the “Size” field, enter the new size for your disk.
  6. At the bottom of the disk details page, click “Save” to apply your changes to the disk.
  7. After you resize the disk, you must resize the disk partitions so that the operating system can access the additional space.

If you are using CLI then you can use the below command.

gcloud compute disks resize example-disk --size 250

Using traditional way

To increase the root disk size in Google Compute Engine, you must create a snapshot of the existing root disk, create a new disk with increased size from the snapshot, and then attach the new disk to the instance.

Here’s a step-by-step guide:

Step 1: Create a snapshot of the existing root disk

  1. Go to the Google Cloud Console: https://console.cloud.google.com/
  2. Sign in with your Google account if you haven’t already.
  3. Select your project from the dropdown menu in the top-right corner.
  4. Click on the navigation menu icon (three horizontal lines) in the page’s top-left corner.
  5. Navigate to “Compute Engine” > “Disks.”
  6. Find the root disk you want to increase the size of, click on the three vertical dots (more options) on the right side, and then click “Create snapshot.”
  7. Enter a name for the snapshot, and click on the “Create” button to create the snapshot.

Step 2: Create a new, larger disk from the snapshot

  1. In the Google Cloud Console, navigate to “Compute Engine” > “Disks.”
  2. Click on the “Create Disk” button at the top of the page.
  3. Enter a name for the new disk.
  4. Under “Source type,” select “Snapshot.”
  5. Choose the snapshot you created in the previous step.
  6. Set the size of the new disk to the desired value (it should be larger than the size of the original root disk).
  7. Choose the same zone as your instance.
  8. Click on the “Create” button to create the new disk.

Step 3: Stop the instance

  1. Before you can attach the new disk, you need to stop the instance.
  2. In the Google Cloud Console, navigate to “Compute Engine” > “VM instances.”
  3. Find your instance in the list, click on the checkbox next to it, and then click the “Stop” button at the top of the page.

Step 4: Detach the existing root disk from the instance

  1. With the instance stopped, click on the instance name to open its details page.
  2. In the “Boot disk” section, click on the “Edit” button.
  3. Under “Additional disks,” find the existing root disk, and click the “Detach” button.
  4. Click on the “Save” button to apply the changes.

Step 5: Attach the new, larger disk to the instance

  1. In the instance details page, click on the “Edit” button again.
  2. Under “Additional disks,” click the “Add item” button.
  3. Choose the new, larger disk you created from the “Disk” dropdown menu.
  4. Click on the “Save” button to apply the changes.

Step 6: Start the instance

  1. In the Google Cloud Console, navigate to “Compute Engine” > “VM instances.”
  2. Find your instance in the list, click on the checkbox next to it, and then click on the “Start” button at the top of the page.

Step 7: Resize the partition and filesystem on the new disk

  1. SSH into your instance.
  2. Depending on the operating system and the filesystem used, you may need to resize the partition and filesystem to utilize the increased disk space. You can use tools like fdisk, parted, resize2fs, or xfs_growfs to perform this task. Follow the official Google Cloud documentation for detailed instructions: https://cloud.google.com/compute/docs/disks/add-persistent-disk#resize_partitions

After completing these steps, the root disk size should be increased!

Leave a Comment