Is there any way to know how much disk space currently running process is using? I have checked ps and top command but could not find out.

Background behind this question:

I have a server which is get filled 20Gb each day. I could not find out where it is taking this space. With some random advice i ran

fuser -m -u /dev/xxx

and killed the processes it shows. After restarting the server i see almos t100Gb space is freed. And again server is getting filled up by previous rate. But killing services this time is not giving me any space. I also have checked log files but no such issue there.

  • 1
    Why? Could you try and clarify what you really want to know? Because in most regards it is not a process that consumes disk space, disk consumption is tied to the UID running that process. – HBruijn Dec 17 '15 at 6:26
  • I have added some information. – chanchal118 Dec 17 '15 at 7:35
  • ncdu helps where your FS is filling up, lsof helps find which processes have open files and where. – HBruijn Dec 17 '15 at 7:45

You can use the iodump perl script :

wget http://aspersa.googlecode.com/svn/trunk/iodump

Turn on Block Dump

echo 1 | sudo tee /proc/sys/vm/block_dump

Run the script for a while (exit with Control & C)

while true; do sleep 1; sudo dmesg -c; done | perl iodump

You'll get a statistic like this:

^C# Caught SIGINT.
TASK                   PID      TOTAL       READ      WRITE      DIRTY DEVICES
jbd2/sda3-8            620         40          0         40          0 sda3
jbd2/sda1-8            323         21          0         21          0 sda1
#1                    4746         11          0         11          0 sda3
flush-8:0             2759          7          0          7          0 sda1, sda3
command-not-fou       9703          4          4          0          0 sda1
mpegaudioparse8       8167          2          2          0          0 sda3
bash                  9704          1          1          0          0 sda1
bash                  9489          1          0          1          0 sda3
mount.ecryptfs_       9698          1          1          0          0 sda1

Do not forget to disable kernel Block Dump

echo 0 | sudo tee /proc/sys/vm/block_dump

Source: http://www.xaprb.com/blog/2009/08/23/how-to-find-per-process-io-statistics-on-linux/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.