2

I have a problem that my disk is filling up but I cant find the files that fill it. When I run df -h I get:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        53G   51G  2.0G  97% /
devtmpfs        2.0G  4.0K  2.0G   1% /dev
none            395M  204K  395M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            2.0G     0  2.0G   0% /run/shm
none            100M     0  100M   0% /run/user

I cleared all caches, logs and auto remove files. When I read this command du -h /var | sort -nr | head -n 10 I get:

1016K   /var/www/soFit/cache/class_folder-242/soinfitcom/cl
1016K   /var/www/landing/PHPMailer/vendor
1008K   /var/www/dating/libs/vendor
988K    /var/www/libs/mPDF/ttfontdata
968K    /var/www/landing/PHPMailer/vendor/phpmailer
964K    /var/www/landing/PHPMailer/vendor/phpmailer/phpmailer
960K    /var/www/soFitTest/groupChats/vendor/symfony/http-foundation
960K    /var/www/soFitTest/chat/vendor/symfony/http-foundation
960K    /var/www/soFit/groupChats/vendor/symfony/http-foundation
960K    /var/www/soFit/chat/vendor/symfony/http-foundation

Using du -x / | sort -rn | head -n 10

2471828 /
1592004 /var
1091532 /var/lib
929776  /var/lib/mysql
776620  /usr
715092  /var/lib/mysql/soFit
306064  /var/www
291376  /usr/lib
269176  /usr/share
180868  /var/www/libs

My mysql db size is ~500MB, not that big.

Where is all the 51G of space are gone to?

My linux is: Debian GNU/Linux 7.11 (wheezy)

du -h --max-depth=1 /
4.0K    /dev
6.4M    /etc
4.0K    /mnt
759M    /usr
4.0K    /selinux
5.5M    /root
20K     /home
24K     /srv
4.0K    /opt
0       /sys
8.0K    /tigo
8.0K    /media
16K     /lost+found
1.6G    /var
6.5M    /sbin
4.0K    /lib64
7.0M    /bin
4.0K    /.ssh
204K    /run
15M     /lib
4.0K    /boot
12K     /tmp
du: cannot access `/proc/4557/task/19375/fdinfo/312': No such file or directory
du: cannot access `/proc/13067/task/13067/fd/4': No such file or directory
du: cannot access `/proc/13067/task/13067/fdinfo/4': No such file or directory
du: cannot access `/proc/13067/fd/5': No such file or directory
du: cannot access `/proc/13067/fdinfo/5': No such file or directory
0       /proc
61M     /backups

2.4G /

The answer was to find the files using: lsof | grep -i deleted and to delete this files.

Shutdown the machine completely not only reboot

var/libs/mysql delete (none).log

dasdasd
  • 129

2 Answers2

2

There may be processes which keep large files open that were already deleted. You can find such open files with lsof, or you could just reboot the machine if that is feasible (i.e. if it's not a server that needs to stay up). See Find and remove large files that are open but have been deleted (Sorry, typing on my phone, so copy/paste is not really comfortable)

0

You can use du -h with the --max-depth parameter which will get the summary of the folders in the depth you defined, e.g. for depth of 2 folders you can use:

du -h --max-depth=2 /

Once you'll find which folders holds most of the Data (hint - the size will be in G) you can execute the same command on those folders:

du -h --max-depth=2 /folder/which/holds/GB/OF/DATA

Note: There some graphical tools which can help (depend on the Linux you are using)

how-to-analyze-your-disk-usage-pattern-in-linux holds links to some Linux GUI utils

Yaron
  • 4,289