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:
-
Increase the disk capacity — resize the underlying Elastic Compute Service (ECS) disk in the ECS console.
-
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:
-
SSH access to the node. See Use Workbench to connect to a Linux instance over SSH
-
Read the disk resize overview to understand capacity limits and billing implications. Resizing a disk incurs charges
-
Confirmed which disk you are expanding: system disk or data disk
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.
-
Check current file system usage:
df -hl -
List disk partitions:
sudo fdisk -luExpected 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 filesystemThe Linux filesystem partition (
/dev/vda3) is the one you will extend.Troubleshooting: If
/dev/vdais 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.
-
Extend the partition (
/dev/vda, partition3):sudo LC_ALL=en_US.UTF-8 growpart /dev/vda 3Troubleshooting: If
growpartreports 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. -
Extend the file system:
sudo resize2fs /dev/vda3Troubleshooting: If
resize2fsreturns a "bad magic number" or "No such file or directory" error, confirm that the partition device (/dev/vda3) matches the output from Step 1. -
Verify the new capacity:
df -hlExpected output (the
/dev/vda3line 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% / ... -
Restart kubelet to update the node's ephemeral storage capacity:
systemctl restart kubeletImportantRestarting kubelet may briefly affect workloads on the node. Schedule this step during off-peak hours.
-
Confirm that Kubernetes reflects the new ephemeral storage size. Replace
cn-qingdao.192.XX.XX.88with your actual node name:kubectl get node cn-qingdao.192.XX.XX.88 -o yaml | grep ephemeral-storageThe
ephemeral-storagevalue 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.
-
List disk partitions:
sudo fdisk -luExpected 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 bytesThe data disk (
/dev/vdb) has no sub-partitions. Extend the file system directly on the disk device—nogrowpartstep needed.Troubleshooting: If
/dev/vdbis 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.
-
Extend the file system directly on the data disk device:
sudo resize2fs /dev/vdbTroubleshooting: If
resize2fsreturns 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. -
Restart kubelet to update the node's ephemeral storage capacity:
systemctl restart kubeletImportantRestarting kubelet may briefly affect workloads on the node. Schedule this step during off-peak hours.
-
Verify the new capacity:
df -hlExpected output (the
/dev/vdbline 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/vdbpartition now shows close to 50 GiB, confirming the data disk was successfully expanded.
What's next
-
Extend the partitions and file systems of disks on a Linux instance — detailed guidance on partition and file system extension, including advanced scenarios