hamburger icon close icon
Google Cloud Storage

How To Resize a Google Cloud Persistent Disk Attached to a Linux Instance

If you’ve been using the public cloud you know that leveraging its managed services can bring you some incredible advantages. When using Google Cloud Storage services, understanding how to properly configure different services can make a big difference by providing greater flexibility while at the same time reducing your engineering footprint and monthly costs. The same is true with Google Cloud Persistent Disks.

Taking advantage of Google Cloud Persistent Disk’s built-in features and ability to do online resizing can ensure your business continuity and a smooth sailing.

In this post we’ll take a closer look at Google Cloud Persistent Disks and show how to resize them. For Google Cloud users, this process will provide added flexibility over your deployment, something that you can expand even further with NetApp® Cloud Volumes ONTAP for Google Cloud.

What are Google Cloud Persistent Disks?

Google Cloud Persistent Disks provide Google Compute Engine virtual machine instances with reliable and high-performance block storage.

In the context of a cloud instance, a persistent disk is seen as the default root disk of the virtual machine. This concept differs greatly from a virtual machine in your workstation (with local disk) but it is fairly similar to an on-premises SAN storage system.

Built-in Features of Google Cloud Persistent Disks

There are very interesting out-of-the-box functionalities in Google Cloud Persistent Disks that are worth exploring. These built-in features reduce your operational overhead and also provide you with much greater flexibility. One of the main characteristics of Persistent Disks in Google Cloud is the excellent performance, default built-in encryption, and durability that ensures both redundancy and data integrity.

Each Persistent Disk can grow up to the impressive size of 64 TB. By having the disk volumes located independently from the virtual machine instances, they can be easily detached and retain all the data even after the instance is deleted. In addition, custom virtual images can be created from Persistent Disks to speed up the bootstrap process in applications running in Google Cloud Compute.

Another very popular feature is the ability to resize disks without the need to restart virtual instances, which can help ensure continuous operation without disruption. Let’s take a look at this function in more detail.

Steps to Resizing Google Cloud Persistent Disks

Since Persistent Disks are directly associated with Google Cloud Compute Engine, in order to properly explore the resize functionality we will start by creating a Google Cloud instance. For this example, we will cover the most common real-world use case for resizing disks: extending the Persistent Disk of a running instance without incurring any downtime.

Creating a Google Cloud Instance

  1. First off, you’ll need to create an instance. Navigate to the Compute Engine dashboard in the Google Cloud Platform Console. Under the VM Instances section, click the “Create” button there.

    Compute Engine VM Instances

    Compute Engine section where you initiate the instance creation process.

  2. To create an instance, you will need to provide a name and, optionally, adjust the instance’s Region and Boot Disk image settings. Once all your desired settings are in place, you can proceed and create the instance by clicking the button “Create” at the bottom of the page.

    Create an instance

    Configure the instance settings.

  3. Upon a successful instance launch, details such as the internal and external IPs will be visible in the VM instance list.

    Successful instance launch

    The VM Instance list provides the details of your instances.

  4. Using the SSH connect button you will be able to initiate a browser-interactive SSH connection with the instance.

  5. From within the Google Cloud Linux instance, you can use the command df -h to visualize the current space usage of the Google Cloud mount disk.

Google Cloud Linux Instance

Browser SSH functionality in Compute Engine and instance disk space usage.

Online Resizing of the Google Cloud Storage Persistent Disk

Resizing the Google Cloud Persistent Disk can be done fully online, i.e., with the instance running and without downtime. Below we’ll go through the steps to carry this out.

  1. Resize the Linux File System on the InstanceTo initiate the process, navigate to the Disks section of Compute Engine and select the name of the disk you want to resize.

    Google Cloud Platform

    Compute Engine section with the existing Persistent Disks

  2. Inside the disk detailed view, in addition to extra information about the Google Cloud Persistent Disk, you will also gain access to options such as those that allow you to create a snapshot, create an image, and to change the disk settings. To change the disk size, click on the “Edit” button.

    Disk detailed view

    Details of the Google Cloud Persistent Disk.

  3. The edit panel of the Persistent Disk gives you the opportunity to change the size of the disk. Simply input the new size, which should be higher than what it was initially, and then click the “Save” button at the bottom of the panel.

    Edit panel of persistent disk

    Changing the Persistent Disk size via the editing option.

The change to the Persistent Disk size happens immediately after you save. However, this will not be visible and usable in the Linux file system until you resize the file system.

  1. Using the sudo cfdisk command you will be able to view the disk partitions. After the size change of the Google Cloud Persistent disk, there will be new unused free space that is not allocated by any partition. Exit the cfdisk tool without making any changes.

    sudo cfdisk

    Linux instance cfdisk command view.

  2. To take the unallocated space into use, you can use the command sudo growpart /dev/sda 1 to grow the partition with the new space. Afterwards, use the command sudo resize2fs /dev/sda1 to make an online resize of the Linux filesystem and make the new space usable.

    making an online resize of linux filesystem

    Growing the partition plus online resizing of the Linux file system.


The ability to resize Persistent Disks on-demand is an incredibly powerful functionality that enables customers to take advantage of the elasticity in public cloud.

Now that you’ve seen step-by-step how Persistent Disks can be resized in Google Cloud, you have a solution for a very common real-world scenario that customers often face using cloud instances: the need to increase and expand the size of a Linux file system without any downtime. This functionality will be important to know for any deployment of Cloud Volumes ONTAP on Google Cloud

What do Google Cloud users gain by using Cloud Volumes ONTAP for data management? The same storage efficiency, data protection and cloning features that have made Cloud Volumes ONTAP essential for enterprise deployments on AWS and Azure.

New call-to-action
Bruno Almeida, Technology Advisor

Technology Advisor