Redhat - The output of the df command is inconsistent due to reserved space

 

The command df by default reports the actual free space minus the reserved space, or 0 if the filesystem is using the reserved block space. In order to protect the filesystem from completely running out of space, which could possibly lead to a system hang, ext3 by default sets an option called reserved-blocks-percentage to 5%. This option sets aside a certain percentage of filesystem blocks as reserved to allow system daemons, such as syslogd, to continue to function correctly in the event a filesystem becomes full. It does this by preventing any non-privileged processes from accessing these reserved blocks. Additionally, these reserved blocks are also used by the filesystem to improve performance by reducing file fragmentation.

The reserved-blocks-percentage setting of a filesystem specifies the percentage of the filesystem blocks reserved for the super-user. This avoids fragmentation, and allows root-owned daemons, such as syslogd, to continue to function correctly after non-privileged processes are prevented from writing to the filesystem. The default percentage is 5%.

As can be seen below sda1 is reporting 100% utilisation and 0 available, however 916G - 897G = 19G. This 19G is what's left of the reserved space and as such is not considered available.

df -h
Filesystem            Size  Used Avail Use% Mounted on

/dev/root             9.5G  4.9G  4.2G  55% /
/dev/sda1             916G  897G     0 100% /app
/dev/sdb1             916G  722G  148G  84% /backup
/dev/sdb2             7.9G  6.5G  1.4G  83% /sgs 

The reserved-blocks-percentage setting of a filesystem can be changed as follows.

tune2fs -m 2 /dev/sda1

This changes the number of filesystem blocks to be reserved, to 2%.