Pivotal Knowledge Base


Where is all the disk space?


If there is need to find out where is the disk space allocated, the du/df commands can be used.

  • df -h -> show disk used/free disk space per mount point
  • du -> show used space per directory

A handy command to find out which directory contains the biggest files is the following:

DIR="/data/lubo/42/gpseg0/base"; du -sb `find $DIR -type d` | sort -n

This will find the space usage for all directories under the specified directory (space usage is cumulative) and then sort the directories by used space. Based on the output it is easy to track where are the big files.

Note: Keep in mind that in Linux/Unix deleting a file does not release the free space until all the processes that have opened this file have either closed the file or exited. This means that if you delete a huge log file, it will not show in the directory listing, but the space will not be released until the program that has it opened closes it. You can see if there are such files by using "lsof" - deleted files will be marked as (deleted). The following command will show the space used by deleted files:

lsof | awk '/deleted/ {sum+=$7} END {print sum}'


  • Avatar
    Krzysztof Byszewski

    In my case the customer had an NFS mount using /backup directory. When I unmounted the NFS mount the /backup itself had 37GB of backups that you couldn't see when it was mounted. Before troubleshooting root directory space issue always unmount everything

Powered by Zendesk