All Products
Search
Document Center

:Run the df command on a Linux instance to check that the disk capacity is not consistent with the purchased capacity

Last Updated:Dec 30, 2020

Overview

Run the df-h command on the Linux instance to view the disk capacity.

 

Detail

This topic uses a 200 GB disk as an example to describe why only 197G disk is displayed after the Linux is formatted and mounted. The reason is that the value of the Used parameter plus the value of the Avail parameter is different from that of the Size parameter.

 

Inode node usage

Run the following command as the root user to view the partition information of the disk:

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

Note:[$Partition] specifies a Partition.

The following command output is returned.

Note:

  • Inode: records the attributes of an archive. An archive occupies an Inode. It also records the Block number of the data where the archive is located.
  • Block: records the actual file content.

This function computes the disk space occupied by the Inode nodes by using the following formula.

Inode count * Inode size / 1024 / 1024 / 1024

We can verify that the Inode has 3.125 GB of disk space.

13107200 * 256 / 1024 / 1024 / 1024 = 3.125G

Therefore, the output of the df-h command does not contain the 3.125 GB Inode.

 

System reserved space

Continue watching df-h command output result of the found Used parameter value plus the Avail parameter value and is less than the Size of the parameter value The sum of MB and GB is a little over GB, but the difference between the original world disk and the world of 197G is less than 10 GB. Therefore, the disk has reserved space.

Run the following command as the root user to view the partition information of the disk:

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

The following command output is returned.

You can use the following formula to calculate the disk space occupied by the system reserved space.

Reserved block count * Block size / 1024 / 1024 / 1024

Enter the parameter values used in this example into the formula. Make sure that the reserved space occupies about 10 GB disk space. The sum of the value of the Used parameter plus the value of the expect parameter plus the value of the system reserved space parameter is equal to the value of the Size parameter.

2621361*4096 / 1024mm /1024 / 1024 ≈ 10G

 

Application scope

  • ECS