All Products
Search
Document Center

Container Service for Kubernetes:Resize the system disk of a node when the disk space is insufficient

Last Updated:Mar 26, 2026

When disk usage on a node is high or the current disk size no longer meets your workload requirements, expand the system disk or data disk without interrupting running workloads. Online resizing takes effect immediately—no node reboot required.

If the node runs ContainerOS, see Resize the system disk of a ContainerOS node online instead.

How it works

Expanding a node disk involves two layers of changes:

  1. Increase the disk capacity — resize the underlying Elastic Compute Service (ECS) disk in the ECS console.

  2. Extend the partition and file system — make the additional space visible to the operating system on the node.

After both steps complete, restart kubelet so that Kubernetes updates the ephemeral-storage capacity for the node.

The procedure differs slightly between system disks and data disks:

Disk type Partition extension needed? File system extension needed?
System disk (for example, /dev/vda3) Yes — run growpart first Yes — run resize2fs
Data disk (for example, /dev/vdb) No — the disk has no extra partition Yes — run resize2fs directly

Prerequisites

Before you begin, ensure that you have:

Expand the system disk

Step 1: Check the current disk state

Log on to the node and verify the current disk usage and partition layout.

  1. Check current file system usage:

    df -hl
  2. List disk partitions:

    sudo fdisk -lu

    Expected output:

    Disk /dev/vda: 20 GiB, 21474836480 bytes, 41943040 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: FD47CD2F-8911-47B3-94A7-76CAE693CF78
    
    Device      Start      End  Sectors  Size Type
    /dev/vda1    2048     6143     4096    2M BIOS boot
    /dev/vda2    6144   415743   409600  200M EFI System
    /dev/vda3  415744 41940991 41525248 19.8G Linux filesystem

    The Linux filesystem partition (/dev/vda3) is the one you will extend.

    Troubleshooting: If /dev/vda is not listed in the output, verify that the disk is attached to the node in the ECS console.

Step 2: Increase the disk capacity in ECS

Log on to the ECS console and resize the system disk. See Resize a disk to extend the disk capacity for usage notes and step-by-step instructions.

Use online resizing so the change takes effect without rebooting the node.

Step 3: Extend the partition and file system

After the ECS disk resize completes, run the following commands on the node.

  1. Extend the partition (/dev/vda, partition 3):

    sudo LC_ALL=en_US.UTF-8 growpart /dev/vda 3
    Troubleshooting: If growpart reports that the partition is already at maximum size, the ECS disk resize may not have propagated yet. Wait a few minutes and retry. If the problem persists, verify the new disk size in the ECS console.
  2. Extend the file system:

    sudo resize2fs /dev/vda3
    Troubleshooting: If resize2fs returns a "bad magic number" or "No such file or directory" error, confirm that the partition device (/dev/vda3) matches the output from Step 1.
  3. Verify the new capacity:

    df -hl

    Expected output (the /dev/vda3 line should reflect the new size, close to 200 GiB in this example):

    Filesystem      Size  Used Avail Use% Mounted on
    devtmpfs        3.7G     0  3.7G   0% /dev
    tmpfs           3.7G     0  3.7G   0% /dev/shm
    tmpfs           3.7G   20M  3.7G   1% /run
    tmpfs           3.7G     0  3.7G   0% /sys/fs/cgroup
    /dev/vda3       197G  4.5G  184G   3% /
    ...
  4. Restart kubelet to update the node's ephemeral storage capacity:

    systemctl restart kubelet
    Important

    Restarting kubelet may briefly affect workloads on the node. Schedule this step during off-peak hours.

  5. Confirm that Kubernetes reflects the new ephemeral storage size. Replace cn-qingdao.192.XX.XX.88 with your actual node name:

    kubectl get node cn-qingdao.192.XX.XX.88 -o yaml | grep ephemeral-storage

    The ephemeral-storage value should be close to 200 GiB.

Expand a data disk

Step 1: Check the current disk state

Log on to the node and verify the current partition layout.

  1. List disk partitions:

    sudo fdisk -lu

    Expected output:

    Disk /dev/vda: 20 GiB, 21474836480 bytes, 41943040 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: FD47CD2F-8911-47B3-94A7-76CAE693CF78
    
    Device      Start      End  Sectors  Size Type
    /dev/vda1    2048     6143     4096    2M BIOS boot
    /dev/vda2    6144   415743   409600  200M EFI System
    /dev/vda3  415744 41940991 41525248 19.8G Linux filesystem
    
    
    Disk /dev/vdb: 45 GiB, 48318382080 bytes, 94371840 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    The data disk (/dev/vdb) has no sub-partitions. Extend the file system directly on the disk device—no growpart step needed.

    Troubleshooting: If /dev/vdb is not listed, verify that the data disk is attached to the node in the ECS console.

Step 2: Increase the disk capacity in ECS

Log on to the ECS console and resize the data disk to the target size (for example, 50 GiB). See Resize a disk to extend the disk capacity for step-by-step instructions.

Use online resizing so the change takes effect without rebooting the node.

Step 3: Extend the file system

After the ECS disk resize completes, run the following commands on the node.

  1. Extend the file system directly on the data disk device:

    sudo resize2fs /dev/vdb
    Troubleshooting: If resize2fs returns an error about the file system type, confirm that the data disk uses ext4. If it uses a different file system type, use the corresponding resize tool for that file system.
  2. Restart kubelet to update the node's ephemeral storage capacity:

    systemctl restart kubelet
    Important

    Restarting kubelet may briefly affect workloads on the node. Schedule this step during off-peak hours.

  3. Verify the new capacity:

    df -hl

    Expected output (the /dev/vdb line should reflect the new size, close to 50 GiB in this example):

    Filesystem     Type      Size  Used Avail Use% Mounted on
    devtmpfs       devtmpfs  3.7G     0  3.7G   0% /dev
    tmpfs          tmpfs     3.7G     0  3.7G   0% /dev/shm
    tmpfs          tmpfs     3.7G   20M  3.7G   1% /run
    tmpfs          tmpfs     3.7G     0  3.7G   0% /sys/fs/cgroup
    /dev/vda3      ext4      197G  4.5G  184G   3% /
    /dev/vda2      vfat      200M  5.8M  195M   3% /boot/efi
    /dev/vdb       ext4       49G  2.7G   44G   6% /var/lib/container
    ...

    The /dev/vdb partition now shows close to 50 GiB, confirming the data disk was successfully expanded.

What's next