Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Since /var is not a separate filesystem it is usually the first candidate to check. It contains /var/log which is where messages (system log) and other logs (e.g. mail logs) go. It also contains /var/tmp where some applications write their temporary files.
A common issue when there is disparity between du and df is that you've tried to delete (rm) an "open" file. When you do that only the name is deleted. The data in the inode is still present until the process that is holding the file "open" goes away. Often people will do something like "rm /var/log/messages" because they see that log taking up space but that log is being held "open" by syslogd (and sometimes other processes).
A simple way to clear such "open" file deletions is to reboot the system as it will stop all processes. However you don't have to reboot. You can run "lsof" and look for lines that have large numbers for size of CHR (character files) and see what process is associated. If it isn't showing you the file name it may be because you deleted the name so stopping and restarting such a process will clear the issue.
@suicidaleggroll:
# du -sh /* | grep G
12G /home
du: cannot read directory `/proc/fs/vmblock/mountPoint': No such file or directory
du: cannot access `/proc/5360/task/5360/fd/4': No such file or directory
du: cannot access `/proc/5360/task/5360/fdinfo/4': No such file or directory
du: cannot access `/proc/5360/fd/4': No such file or directory
du: cannot access `/proc/5360/fdinfo/4': No such file or directory
4.1G /usr
What does "du -sxh /" show? What does "df -h /" show?
The former command should give you total usage for "/" as du sees it in "human readable" format restricting it only to the local filesystem / (ignoring submounts on /). df always shows you only whats in the filesystem ignoring other submounts on it.
If a reboot didn't free up anything you don't have the open file issue I mentioned. (Unless of course you deleted something after the reboot.)
What I typically do to try to narrow down where space is used is:
du -sk /* |sort -n
That will output a list of used files (mostly directories) in / from smallest to largest so the largest appear at end of list.
You'd ignore any submounts in that output (i.e. /boot and /home are submounts based on your earlier df output so you should ignore them for troubleshooting / space because they have their own space).
You can then drill down on whatever your largest item in the list is. So for example if /var were the largest you can run:
du -sk /var/* |sort -n
And keep drilling down successfully.
Again my first thought would be /var so I might start with "du -sk /var/* |sort -n" first THEN if I didn't find anything interesting there focus on the rest of /.
Last edited by MensaWater; 08-03-2012 at 12:38 PM.
du -xh --max-depth=1 to get the size of only the first level of directories, and gradually dig deeper and deeper. easier to put the size of all the same level of directory into context I find.
du -xh --max-depth=1 to get the size of only the first level of directories, and gradually dig deeper and deeper. easier to put the size of all the same level of directory into context I find.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.