0

I have twin server they are made from the same google cloud images. tunnel1 I had flushed the log files and disk space has been claimed back tunnel2 I did the same thing, but it does not get me back the spaces.

I have tried manually search the with du, but it does not work.

# du -ah / | sort -n -r | head -n 5
du: cannot access '/proc/6033/task/6033/fd/4': No such file or directory
du: cannot access '/proc/6033/task/6033/fdinfo/4': No such file or directory
du: cannot access '/proc/6033/fd/3': No such file or directory
du: cannot access '/proc/6033/fdinfo/3': No such file or directory
1020K   /usr/lib/git-core/git-daemon
1020K   /usr/lib/git-core/git-credential-cache--daemon
1020K   /lib/modules/4.9.0-6-amd64/kernel/drivers/net/ethernet/broadcom/bnx2x/bnx2x.ko
1020K   /lib/modules/4.9.0-6-amd64/kernel/drivers/media/usb/dvb-usb
1016K   /usr/lib/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/compute_dev_alpha.json


# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            2.5G     0  2.5G   0% /dev
tmpfs           497M   33M  464M   7% /run
/dev/sda1        15G   12G  2.9G  80% /
tmpfs           2.5G     0  2.5G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           2.5G     0  2.5G   0% /sys/fs/cgroup
Stone
  • 161

2 Answers2

3

It doesn't work because you're using the -h flag with du, which turns values like "1024K" into "1M" and since you sort by numbers you will see that 1022K is bigger than 500M because 1022 > 500, the unit doesn't interest sort -n.

The right command for this would be something like

find / -type f -exec du -ahm {} + | sort -n -r | head -n 5

First of all it only searches for files (find -type f) and then it uses blocksize = 1M (the -m-flag on du).

Broco
  • 2,029
  • 13
  • 21
  • Thank you very much. After my colleague reboot it. I can not reproduce it by now :( I am started to think about bug in the application. – Stone Oct 04 '18 at 09:53
0

Most probably you have "flushed" logs in use. When this happens the disk space looks as filled because the file descriptors are still writing. This can be fixed by restarting the app processes handling the file descriptors as in your case, you have done by rebooting the machine. This is why fuser command is used, to check which files are in use.

dampi0
  • 31