search

Home  >  Q&A  >  body text

Operation and maintenance - The results of df -h and du -sh in Linux space are quite different. . .

The cloud server alarms that the remaining space is insufficient. Log in to the server and use df -h to view the situation as follows:

But when I used du-sh * in the root directory to check the size of each folder, I found that the sum of these folders was far from 31G. Why is this? (The 23G of share is a mounting disk, which is reflected in df -h in the above picture)

过去多啦不再A梦过去多啦不再A梦2830 days ago790

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 13:30:58

    The way they count is different. One possibility of such a big difference is that the files being used are deleted.
    You can use the command lsof|grep delete to see which files have been deleted but are still occupied by the program.
    These programs need to be restarted to free up the space occupied.

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 13:30:58

    The basic reason is what @vvpale said,
    The reasons and solutions for the inconsistent disk space usage displayed by df and du are for reference

    reply
    0
  • ringa_lee

    ringa_lee2017-05-16 13:30:58

    Two situations

    1. df includes the space that has been deleted but not released, and can be viewed through lsof grep deleted.
    2. There are contents in some directories, but they are used as other partitions on the mount, so the contents in this directory cannot be seen, but they are still there.

    reply
    0
  • Cancelreply