A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/compute/docs/disks/resize-persistent-disk below:

Increase the size of a persistent disk | Compute Engine Documentation

Increase the size of a persistent disk

Stay organized with collections Save and categorize content based on your preferences.

Linux Windows

You can increase the size of your Persistent Disk when your virtual machine (VM) instance requires additional storage space or increased performance limits. You can increase the disk size at any time, whether or not the disk is attached to a running VM.

This page discusses how to increase the size of a Persistent Disk. To increase the size of a Google Cloud Hyperdisk volume, see Modify the settings of a Hyperdisk.

You can only increase, and not decrease, the size of a disk. To decrease the disk size, you must create a new disk with a smaller size. Until you delete the original, larger disk, you are charged for both disks.

When you create a custom Linux image or custom Windows image, you need to manually increase the size of the boot and non-boot disks. If you're using a public image, Compute Engine automatically resizes the boot disks.

Increasing the size of a disk doesn't delete or modify disk data, but as a best practice, before you make any changes to the file system or partitions, always back up your disk by creating a snapshot.

Compute Engine manages the hardware behind persistent disks, so that you can add and resize your disks without handling striping or redundancy.

Important: Public Google Cloud Images don't use MBR partition types and can only have GPT partition types. Imported Disks with MBR partition type can only be increased to 2 TB. partitions beyond 2 TB or changing the partition type from MBR to GPT isn't supported. Images with MBR partitions are not supported by Cloud Customer Care. Before you begin Required roles and permissions

To get the permission that you need to resize a Persistent Disk, ask your administrator to grant you the following IAM roles on the project:

For more information about granting roles, see Manage access to projects, folders, and organizations.

This predefined role contains the compute.disks.update permission, which is required to resize a Persistent Disk.

You might also be able to get this permission with custom roles or other predefined roles.

Increase the size of a disk

To increase the size of a boot or non-boot disk, use the following procedures:

Note: You can resize an Extreme Persistent Disk only once in a 6 hour period. Console
  1. In the Google Cloud console, go to the Disks page.

    Go to Disks

  2. In the list of persistent disks in your project, click the name of the disk that you want to resize.

  3. On the disk details page, click editEdit. You might need to click the more_vert More actions menu and then editEdit.

  4. In the Size field, enter the new size for your disk. Disks with MBR partition tables can only resize up to 2 TB.

  5. Click Save to apply your changes to the disk.

The new disk size is displayed in the list of disks.

gcloud

Use the gcloud compute disks resizecommand and specify the --size flag with the new disk size, in gibibytes (GiB).

gcloud compute disks resize DISK_NAME \
    --size DISK_SIZE \
    --zone=ZONE

Replace the following:

Terraform

Choose one of the following options to resize either zonal disks or Regional Persistent Disk:

Zonal disk

To change the size of a Persistent Disk, you can use the google_compute_disk resource and use the size parameter.

If you include the size parameter along with the image or snapshot parameter, the size value must be equal to or greater than the size of the image or snapshot.

If you omit the image and snapshot parameters, you can set the size parameter to less than the existing disk size. If you do this, Terraform destroys the disk and creates a new empty Persistent Disk.

Caution: To prevent Terraform from destroying and re-creating a disk, you can add the lifecycle.prevent_destroy = true setting to the Terraform configuration.

During the re-creation, Terraform doesn't copy over other data that isn't also included in the Terraform configuration, such as labels or snapshot schedules.

Regional Persistent Disk

To change the size of a Regional Persistent Disk, you can use the google_compute_region_disk resource and use the size parameter.

If you include the size parameter along with the image or snapshot parameter, the size value must be equal to or greater than the size of the image or snapshot.

If you omit the image and snapshot parameters, you can set the size parameter to less than the existing disk size. If you do this, Terraform destroys the disk and creates a new empty RegionalPersistent Disk.

Caution: To prevent Terraform from destroying and re-creating a disk, you can add the lifecycle.prevent_destroy = true setting to the Terraform configuration.

During the re-creation, Terraform doesn't copy over other data that isn't also included in the Terraform configuration, such as labels or snapshot schedules.

REST

To resize a Persistent Disk, construct a POST request to the compute.disks.resize method.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME/resize
{
  "sizeGb": "DISK_SIZE"
}

To resize a Regional Persistent Disk, construct a POST request to the compute.regionDisks.resize method.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/disks/DISK_NAME/resize
{
   "sizeGb": "DISK_SIZE"
}

Replace the following:

Resize the file system and partitions

After increasing the size of a disk, you might need to resize its file system and partitions. The following list shows additional information for boot and non-boot disks:

The following example shows how to manually resize the root partition and file system of a boot disk, and how to manually resize the file system of a non-boot data disk with no partition table. This example assumes that the disk is attached using SCSI and was previously formatted and mounted.

If your Persistent Disk was attached using NVMe, see Resize the file system and partitions for example output for NVMe-attached disks.

Linux VMs
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Next to the instance that has the new attached disk, click the SSH button. The browser opens a terminal connection to the instance.

  3. Use the df and the lsblk commands to list the size of the file system and to find the device names for your disks.

    $ sudo df -Th
    
    Filesystem      Type     Size   Used  Avail  Use%  Mounted on
    /dev/sda1       ext4     9.7G   1.2G   8.5G   12%  /
    /dev/sdb        ext4     250G    60M   250G    1%  /mnt/disks/disk-1
    
    
    $ sudo lsblk
    
    NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sda       8:0    0   20G  0 disk
    └─sda1    8:1    0   10G  0 part /
    sdb       8:16   0  500G  0 disk /mnt/disks/disk-1
    
    

    This example includes the following disks:

    The df command shows that the /dev/sda1 partition is mounted as the root file system, and the /dev/sdb disk is mounted as a non-boot data disk at /mnt/disks/disk-1. Make note of the Type column, which indicates if your disk uses an ext4 or xfs file system.

  4. Verify the partition type:

    sudo parted -l
    
    Alternatively, to see information only for a specific disk:
    sudo parted -l /dev/DEVICE_NAME
    
    Look for the field Partition Table. If the value is msdos, then the disk has an MBR partition type. This means the maximum size of such a disk is 2 TB.
  5. Resize the root partition and file system on the boot disk. This example assumes the VM image does not support automatic root partitioning and file system resizing.

    1. Resize the root partition by using parted. For example, the following commands expand partition 1 of /dev/sda to the maximum possible size:

      1. Open parted on the /dev/sda partition:

        sudo parted /dev/sda
      2. At the (parted) prompt, enter:

        resizepart
      3. At the Partition number? prompt, enter:

        1
      4. At the Warning: Partition /dev/sda1 is being used. Are you sure you want to continue? prompt, enter:

        Yes
      5. At the End? prompt, enter

        100%
      6. At the (parted) prompt, enter:

        quit
    2. Read the new partition table using partprobe.

      sudo partprobe /dev/sda
      
    3. Extend the file system:

      • If you are using ext4, use the resize2fs command:

        sudo resize2fs /dev/sda1
        
      • If you are using xfs, use the xfs_growfs command:

        sudo xfs_growfs -d /
        
      • If you are using btrfs, use the btrfs command:

        sudo btrfs filesystem resize max /
        
  6. Resize the file system on the non-boot data disk.

  7. Use the df command to verify that the file system is extended. For example:

    df -h /dev/sdb
    
    Filesystem  Size  Used  Avail  Use%  Mounted on
    /dev/sdb    493G   70M  492G     1%  /mnt/disks/disk-1
    
Windows VMs

Use the Windows Disk Management utility to resize partitions on a Windows instance.

  1. In the Google Cloud console, go to the VM instances page.

    Go to VM instances

  2. Next to the instance that has the resized disk, click the RDP button. The browser opens an RDP connection to the instance.

  3. Right-click the Windows Start button and select Disk Management to open the Disk Management tool.

  4. Show the disks partition type by running in Powershell:

    Get-Disk
    
    In the Partition Style column, if the value is MBR then the disk has an MBR partition type. This means the maximum size of such a disk would be 2 TB.
  5. Refresh the Disk Management tool so that it recognizes the additional space on your zonal persistent disk. At the top of the Disk Management window, click Action and select Refresh.

  6. On the disk that you resized, right-click the formatted partition and select Extend Volume.

  7. Follow the instructions in the Extend Volume Wizard to extend your existing partition to include the extra disk space. If the existing partition is formatted in NTFS, the maximum partition size is limited by its cluster size settings.

  8. After you complete the wizard and the volume finishes formatting, check the Status column on the list of attached disks to ensure that the new disk has a Healthy status.

You don't need to restart your VM after you complete this process. You can now use the added disk space to store data.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-02 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-02 UTC."],[[["Persistent Disk size can be increased at any time to accommodate additional storage needs or performance enhancements, but it's important to note that decreasing disk size is not possible, requiring the creation of a new, smaller disk if necessary."],["Before resizing, it is recommended to back up the disk data by creating a snapshot to prevent potential loss of data, even though increasing the disk size itself doesn't delete or modify disk data."],["When using custom Linux or Windows images, manual resizing of boot and non-boot disks is required, while Compute Engine automatically resizes boot disks when using public images."],["Disks using MBR partition tables are limited to a maximum size of 2 TB, whereas public Google Cloud images use GPT partition types, which allows for larger sizes."],["Resizing a Persistent Disk involves adjusting the disk size in the Google Cloud console, through `gcloud` commands, Terraform configurations, or via REST API calls, followed by potentially resizing the file system and partitions on the operating system level, with specific steps for Linux and Windows VMs."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4