When I do df -h on my Linux server, it shows 100% used. I have since deleted files to create space. When I do du -sh ./* to see the capacity of each directory, it does not add up to the 2 TB capacity of my drive and my server/network monitor continues to tell me I have used 100% of my space. Why?

# du -sh ./*
4.0K    ./%1
32G     ./datapump
4.0K    ./Desktop
1.9G    ./faxes
12K     ./guru
2.1G    ./home
344K    ./named
9.5M    ./oradiag_root
4.0K    ./svnpassword
0       ./tape_error
20G     ./test
# df
Filesystem            Size  Used Avail Use% Mounted on
                      1.9T  1.9T     0 100% /
/dev/sda1              99M   21M   74M  22% /boot
tmpfs                 4.9G     0  4.9G   0% /dev/shm
                      3.7T  669G  3.0T  18% /home/MARMOT
  • 1
    You are only running du -sh over (non-dot) directories in the home directory of user root. Compare du -sh /* – user4556274 Aug 22 '16 at 15:16
  • 1
    Did the logfiles used almost all of your space? If yes, try restarting the programs that write to these logfiles - if the programs still have open handles to these files, they are not deleted until you close the programs (you just down see them using ls, but they are still there). – Martin Nyolt Aug 22 '16 at 15:42
  • @user4556274: du -sh ./* shows non-dot directories under the current directory, whatever that happens to be. If it's run from root's home directory, you're right, but if it's run from the root directory, it's essentially equivalent to du -sh /*. (Yes, the presence of a Desktop/ directory suggests it's run from some account's home directory -- not necessarily root.) – Keith Thompson Aug 22 '16 at 18:55
  • @KeithThompson, the current directory in this case was the home directory of the root user, although the question has since been edited by another user to remove that information. – user4556274 Aug 22 '16 at 19:00

df -h prints global stats

du -sh ./* counts and prints contents depending on the location you are in. Thats because the dot . in ./* donotes the current directory.

Run pwd to find out where you are.

To get the top stats, you need to move to the bottom of the hierarchy tree:

cd /

And now try:

du -sh

You might also run du -sh /* for the whole tree from any location. Notice there's no dot before the slash /. /* means all directories stemming from the bottom of the directories tree.

Some directories are not readable for regular users. To read them also use the command with sudo. Ex:

sudo du -sh /*

Linux Server capacity indicates 100% used even after log files have been emptied

If you remove a file that's still open (a process still has it open) the space will not be free'd until that process is either killed or sent a HUP signal.

If the files removed were from syslog (sysklogd or rsyslog) restart or reload the daemon.

If the files removed were part of Apache or some other web service restart that service.

If this is a custom application restart it. Alternatively, you can try sending a HUP signal (kill -HUP PID) to see if it will close the file and re-open it.

If you don't know what the process is that has the file open you can use lsof to find open deleted files.

$ lsof -P -n | grep deleted
cat       12313  gene    1w      REG    8,1        0   3129916 /tmp/stackexchange.log (deleted)
  • Depends on how they "emptied" the file. If you truncate the file it'll free the space and you can truncate deleted files by writing to the file descriptor underneath /proc – Bratchley Aug 22 '16 at 19:12

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.