What does “1K-blocks” column mean in the output of `df`

disk-usage

What does "1K-blocks" column mean in the output of df?

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda7       21181308  19302672    802668  97% /
udev             4070176         4   4070172   1% /dev
tmpfs             815536       972    814564   1% /run

I guess it is the size of a partition in KB?

Does "1K-blocks" mean the size of each block of a partition is 1KB?

Does a "block" here mean the same as a cluster of a file system?

Best Answer

The 1K-blocks header is the total space available, measured in 1kB units. Historically, and according to the POSIX standard, df should report the space in units of 512-byte blocks; you can get that output by doing:

POSIXLY_CORRECT=1 df

The "block" here is simply the unit used for the amounts, it is not related to the file system blocksize (or cluster size, if appropriate for the file system involved). For ext2/ext3/ext4 filesystems you can display the file system info with:

sudo dumpe2fs -h /dev/sda7

(replace /dev/sda7 with the file system device).

Note that if you add The Used and Available columns you don't get the total size shown; this is because of blocks that are reserved for root as shown in the output of dumpe2fs as Reserved block count:. Those blocks can only be used by root, the idea behind this is that if a user fills up the filesystem, critical stuff still works and root can fix the problem.

Related Question