First of all, the pipe on head -n10
is only going to print out the first 10 directory entries in /var
. If you have more than 10 directories, they are not being reported on. Secondly, du -h
is not quite the best tool to use here as it is reporting duplicated allocation because child directories are being reported on.
Try this instead to get a better idea on allocation of all first level directories under /var
:
# find /var -maxdepth 1 -type d -exec du -smh '{}' \;
21G /var
18G /var/lib
4.0K /var/local
384K /var/www
86M /var/cache
3.3G /var/log
12K /var/mail
16K /var/lost+found
7.8M /var/backups
840K /var/spool
4.0K /var/tmp
4.0K /var/opt
If you need to drill down into one of those top levels, to report allocation under the parent, simply add the sub directory to the original command. I can easily see elasticsearch
is the culprit behind 18G of allocation within /var
on my system:
# find /var/lib -maxdepth 1 -type d -exec du -smh '{}' \;
18G /var/lib
...
8.0K /var/lib/vim
18G /var/lib/elasticsearch
@fpmurphy suggest the yum
directory may be involved with your problem. To extrapolate on that, whenever you work with yum
all the packages which are downloaded to update the system are retained under /var/cache/yum
by default. You may want to check the contents of the file /etc/yum.conf
and check for the keepcache
setting. What you post suggests that keepcache
has a value of 1
.
If /var/cache/yum
is indeed filling up, you may be able to runyum clean all
to fix things for now. There is evidence this command may not work as advertised however so take heed. I would suggest allocating more space to /var
if possible.