Sizes reported by df and by lsof commands

Posted by George Potemkin on 28-Dec-2015 12:16

/protmp is a file system dedicated to the temp-files of Progress sessions. The total size reported by lsof /protmp (38,625,886K) is 1.85 times larger than the disk usage reported by df -k /protmp (20,825,896K). But in the theory the result should be opposite: df command returns the size in the allocated units plus it includes the size of directory listing that is a file as well. The lsof /could/ count the same file a few times if one of a few processes open the same file a few times but it's not a case with Progress temp files. I verified this explicitely.

On other hand the simple test with only one session does not show the difference between these commands:

pro -T /db1 -t

df -k /db1
36 /db1

lsof /db1
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
_progres 21578 root 5u REG 8,49 0 11 /db1/lbikI7UMD
_progres 21578 root 6u REG 8,49 0 12 /db1/srtJQR0vy
_progres 21578 root 8u REG 8,49 0 13 /db1/rcdKg36et
_progres 21578 root 14u REG 8,49 32768 14 /db1/DBI-1347066080QCDoko

ls -l /
...
drwxr-xr-x 2 root root 4096 Dec 28 17:46 db1

36K (df) = 32K (lsof) + 4K (size of db1 directory)

Why we have the different results for the hundreds Pogress sessions in production environment?
How to check the size of temp files correctly?

Best regards and happy New Year!
George

All Replies

Posted by George Potemkin on 29-Dec-2015 02:32

Could it be that /protmp is mounted in a way when disk space and memory are treated as a common address space? Maybe the lsof (as well as ls itself) reports the both parts of the file's address space while the df command reports only the disk resident part of the files?

This thread is closed