Expand VM disks

This document provides instructions to increase the size of both boot and non-boot virtual machine (VM) disks in Google Distributed Cloud (GDC) air-gapped.

You can increase the size of your VM disk partition when your VM instance requires additional storage space or increased performance limits.

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.

This document is for developers in platform administrator or application operator groups that want to expand VM disks in a Distributed Cloud environment. For more information, see Audiences for GDC air-gapped documentation.

Request IAM roles

To increase the size of your VM disks, contact your Project IAM Admin to request the Virtual Machine Project Admin (project-vm-admin) role.

All VM roles must bind to the namespace of the project where the VM resides. Follow the steps to verify your access.

Disk expansion

Follow the gdcloud or API steps to expand the disk size.

gdcloud

Expand the VM disk:

 gdcloud compute disks resize DISK_NAME \
   --project=PROJECT \
   --size=NEW_SIZE
  • Replace DISK_NAME with the name of the disk.

  • Replace PROJECT with the name of the GDC project in which the VM lives.

  • Replace NEW_SIZE with the new size of the disk.

API

  1. Expand the VirtualMachineDisk by updating the .spec.size field:

    kubectl --kubeconfig MANAGEMENT_API_SERVER \
      -n PROJECT \
      apply  -f - <<EOF
    apiVersion: virtualmachine.gdc.goog/v1
    kind: VirtualMachineDisk
    metadata:
      name: VM_BOOT_DISK_NAME
    spec:
      source:
        image:
          name: BOOT_DISK_IMAGE_NAME
          namespace: vm-system
      size: BOOT_DISK_SIZE
    EOF
    

    Replace the following variables:

    VariableDefinition
    MANAGEMENT_API_SERVER The Management API server kubeconfig file.
    PROJECT The GDC project to create the VM.
    VM_BOOT_DISK_NAME The name of the new VM boot disk.
    BOOT_DISK_IMAGE_NAME The name of the image to use for the new VM boot disk.
    BOOT_DISK_SIZE The size of the boot disk, such as 20Gi.
    This value must always be greater than or equal to the minimumDiskSize of the boot disk image.
  2. Wait until the .status.size field updates to the new size.

Expand the file systems and partitions

After expanding the block device, you must expand the guest's partition and file system so that applications can consume the additional space. Some OS's do this automatically using cloud-init.