Differences
This shows you the differences between two versions of the page.
— |
troubleshooting:df-and-du-show-different-usage [2016-08-09 18:43:25] (current) shaun.reitan created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Linux command df shows different usage than du ====== | ||
+ | There are times when the du and df commands can show different disk usage stats. | ||
+ | |||
+ | lsof is a tool that can be used to find processes holding onto files. If you do not have lsof installed, you will need to install it using your package manager. Examples of how to do this are below. | ||
+ | |||
+ | <code console> | ||
+ | # Debian and Ubuntu | ||
+ | apt-get install lsof | ||
+ | |||
+ | # CentOS, RHEL, and Fedora | ||
+ | yum install lsof | ||
+ | </ | ||
+ | |||
+ | Next we want to use lsof to find the process | ||
+ | |||
+ | <code console> | ||
+ | lsof | grep deleted | ||
+ | </ | ||
+ | |||
+ | If you get any output changes are it looks something like this. | ||
+ | |||
+ | <code console> | ||
+ | httpd | ||
+ | </ | ||
+ | |||
+ | In this case, the process httpd is whats holding onto an 18GB file. You can either kill that process, or issue a restart using init.d or systemctl | ||
+ | |||
+ | <code console> | ||
+ | # systemctl systems | ||
+ | systemctl restart httpd | ||
+ | |||
+ | # Older init.d systems | ||
+ | service httpd restart | ||
+ | |||
+ | # Even older systems | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | If the process doesn' | ||
+ | |||
+ | <code console> | ||
+ | kill -9 32617 | ||
+ | </ | ||
+ | |||
+ | Now when running df again you should now see df reporting correctly. |