The server has run out of space, it is useless to delete the logs ...

I work as root.

Vyloplinl df -h :

 Filesystem Size Used Avail Use% Mounted on rootfs 188G 177G 1.8G 99% / udev 10M 0 10M 0% /dev tmpfs 6.4G 292K 6.4G 1% /run /dev/disk/by-uuid/47783a3f-1df3-4061-a4b9-42c53642ca6c 188G 177G 1.8G 99% / tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 20G 8.0K 20G 1% /run/shm /dev/md1 496M 33M 438M 7% /boot 

Then did du -hd1a / , it turned out:

 125M /lib 52K /tmp 4.0K /home 23M /boot 584M /opt 6.8M /bin 8.3G /var 4.0K /mnt 2.4G /usr 8.7M /sbin 170M /root 16K /lost+found 216K /log2ban 8.0K /media 12K /srv 0 /dev 4.0K /lib64 300K /run 0 /sys du: cannot access /proc/14876/task/14876/ns/net': No such file or directory * остальные du: cannot access удалены 0 /proc 4.0K /selinux 5.8G /etc 18G / 

As you can see, files are occupied by 18 gigs, and in blocks 177.

Help to understand what is the place, and solve the problem.

  • What is in 8.3G / var and why does / etc take so much? - cheops
  • In var as usual, logs and a working project with all files. etc is bold because the nginx logs happened to be there. - user1607046
  • And in the root / no giant files there? - cheops
  • Not the biggest 9kb. Doesn't du show the total volume occupied by files? There is reason not to trust his calculations? - user1607046
  • Shows rechecked. Really very curious situation. - cheops

1 answer 1

my free answer translation is: Why do “df” and “du” commands show different disk usage?


You probably know that you can delete a file that is still being used by some process, and it will remain available for this process.

because the file descriptor remains in the proc pseudo-file system (in /proc/номер-процесса/fd/ ), and the df program considers the space occupied by such a file used (and it is right).

du, on the other hand, does not add up this space, since there are already no files associated with it.

You can view information about such remote, but still open files, for example, like this:

 $ sudo lsof | grep '(deleted)' 

and restart those processes that still use the deleted files.