2

This question already has an answer here:

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

marked as duplicate by Gilles, DarkHeart, Satō Katsura, phk, Anthony Geoghegan May 16 '17 at 8:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Which linux are you using? – Yaron May 15 '17 at 12:12
  • Debian GNU/Linux 7.11 (wheezy) – dasdasd May 15 '17 at 12:15
  • Why are you only running du in /var? – Henrik May 15 '17 at 12:19
  • Ok, what other commands should I run? – dasdasd May 15 '17 at 12:20
  • No other commands, just use / as an argument to du. I.e. use something like du -xh / | sort... - The | sort... looks alright, but personally I prefer using --max-depth=1 and then repeating in the biggest directory, like @Yaron suggests in his answer. – Henrik May 15 '17 at 12:22
3

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)

  • How I find this deleted files? – dasdasd May 15 '17 at 12:38
  • Added a link to a previous question on this topic. – Hans-Martin Mosner May 15 '17 at 12:58
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

  • I run this command, no big files found. – dasdasd May 15 '17 at 12:19
  • btw I connect my server with ssh, no GUI. – dasdasd May 15 '17 at 12:19
  • @dasdasd - okay, the method I suggested in my answer should work without GUI – Yaron May 15 '17 at 12:25
  • I run this command and I could not find big files, I also increased the depth and could not see it – dasdasd May 15 '17 at 12:28
  • @dasdasd - you should find large folder. and then dig in that folder. did you find large folders (with GB) when running du -h --max-depth=1 / ? what did you find when you enter into those folders and execute du -h /foldername--max-depth=1 /? – Yaron May 15 '17 at 12:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.