How to show which process takes up disk space on Linux

I ran these commands to determine disk space usage on my Linux system.

Filesystem Size Used Avail Use% Mounted on /dev/mapper/foovg-foo 326G 202G 108G 66% /export/data/foo

du -sk * | awk '{sum += $1}END{print sum}' 132161064 ~ 126 GB

So, the difference is 202G - 126G = 76G.

Where is the disk space 76G? How to find out which process holds a file descriptor? What file name is deleted?

On Linux, file descriptors in /proc/pid/fd/are soft links to the actual file.

+3
source share
2 answers

Regardless of whether this is the reason, you can see which processes are stored on remote files using lsof. Something like this might help:

lsof | grep '(deleted)$' | sort -rnk 7

In other words, take all deleted files and sort them in descending order of size.

+2

* du, () , .. , .nfs , .

-c, du, , awk.

:

# cd /export/data/foo
# du -ch . 

, , .

+2

All Articles