All Products
Search
Document Center

:Troubleshoot the difference between cloud disk size and purchased capacity

Last Updated:Aug 14, 2025

When you run the df command to query the capacity of a cloud disk on a Linux Elastic Compute Service (ECS) instance, the queried capacity may be different from the capacity that you purchased for the disk. In most cases, the issue is not caused by insufficient disk space. The issue occurs because part of the disk space is reserved by the system or is occupied by inodes and the metadata of file systems.

Problem description

You purchase a 200-GiB cloud disk for a Linux ECS instance and initialize the disk. When you run the df -h command to query the disk capacity, 197 GiB is returned instead of 200 GiB.

  1. The output of the df -h command displays a total capacity (Size) that is different from the capacity that you purchased for the cloud disk in the ECS console.

  2. The sum of used space (Used) and available space (Avail) is different from the total capacity (Size).

image

Note

The capacity of the disk that you purchased in the ECS console is measured in GiB. In the following examples, the df -h command is run to query the disk partition usage. If you run the df -H command, the disk partition usage in the command output is measured in GB.

  • The df -h command uses 1,024 as the base, and the disk partition usage is measured in a binary unit, such as KiB, MiB, or GiB.

  • The df -H command uses 1,000 as the base, and the disk partition usage is measured in a decimal unit, such as KB, MB, or GB.

For example, the actual size of a partition is 40 GiB. If you run the df -h command, 40G may be returned as the partition capacity. If you run the df -H command, 42G may be returned as the partition capacity. This is because 40 × 1024^3 bytes divided by 1000^3 is equal to approximately 42.95 GB.

Causes

Issue 1: Total capacity (Size) in the df -h output is different from the purchased disk capacity in the ECS console

File system overhead

If you purchased a 200-GiB cloud disk, formatted the disk, and then attached the disk to the Linux ECS instance, you may see that the total capacity is only about 197 GiB. The issue occurs because additional data structure is generated when file systems are created. The data structure occupies disk space. Even if the data structure occupies a small amount of disk space, the data structure does affect the total capacity.

Issue 2: The sum of used space (Used) and available space (Avail) is different from the total capacity (Size)

In most cases, the issue occurs because inodes occupy disk space or an amount of disk space is reserved by the system. For information about how to calculate the disk space occupied by inodes or the space reserved by the system, see the Troubleshooting methods section of this topic.

Inode consumption

A file system allocates an inode to each file to record file attributes, such as the permissions and owner. The inodes occupy an amount of disk space. The disk space occupied by inodes is not counted by the df -h command.

System reservation

In addition to inodes, Linux reserves an amount of disk space to prevent the root directory from being completely filled, which ensures the stability and security of the system. The reserved disk space is not included in the sum of the used space (Used) and the available space (Avail) in the output of the df -h command.

Troubleshooting methods

View detailed information about partitions

Run the following command to view the partition information of the cloud disk:

sudo tune2fs -l /dev/[$Partition] | grep -E "count|size:"
Note

Replace /dev/[$Partition] with the actual name of the partition, such as /dev/vdb1.

The following command output is returned.

image

Calculate the disk space occupied by inodes

Run the following command to obtain the total amount of disk space occupied by inodes:

sudo tune2fs -l /dev/[$Partition] | awk '/Inode count:/{c=$3} /Inode size:/{split($0,a,":"); s=a[2]} END{if(c && s) printf "Inode space: %.2f GiB\n", c*strtonum(s)/(1024^3); else print "Error: Could not find Inode information."}'
Note

Replace /dev/[$Partition] with the actual name of the partition, such as /dev/vdb1.

The following command output is returned.

image

You can also use the following formula to calculate the disk space occupied by inodes:

Calculate the disk space reserved by the system

Run the following command to obtain the total amount of disk space reserved by the system:

sudo tune2fs -l /dev/[$Partition] | awk '/Reserved block count:/{r=$4} /Block size:/{b=$3} END{if(r && b) printf "Reserved space: %.2f GiB\n", r*b/(1024^3); else print "Error: Could not find reserved block or block size information."}'
Note

Replace /dev/[$Partition] with the actual name of the partition, such as /dev/vdb1.

The following command output is returned.

image

You can also use the following formula to calculate the disk space reserved by the system: