Search code examples
linuxamazon-web-servicesamazon-ec2dulinux-disk-free

AWS instance not showing the correct free space


I use AWS and I got an EC2 instance. When I run the command
du -h --max-depth=1

I get:

enter image description here

and When I run the command df -h

I get:

enter image description here

It look I use only 1GB but it show that I am using 7.1GB. So I run the command lsof +L1 to locate some deleted file that process are still using and I found 2 of them:

enter image description here

Then I try to kill those processes,also try to use /proc/PID/fd (> FD) and I try to restart my EC2 instance but none of those thing help me to free the space. The process are always return and I can't figure up why.


Solution

  • du begins in the current directory. Change the directory:

    cd /
    

    Then try your du command again.

    Alternatively, tell du to start with the root directory:

    du -h --max-depth=1 /
    

    Reference and further reading: http://www.linfo.org/du.html