This morning I was greeted with low disk warning on my root partition. So I started with usual investigation path and obviously the result of my first command become the one as shown below.
[root@my-server /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 97G 86G 6.0G 94% /
tmpfs 12G 5.7G 6.1G 48% /dev/shm
/dev/sda2 360G 16G 326G 5% /www
/dev/sdb1 458G 38G 397G 9% /web
/dev/sdc1 458G 42G 393G 10% /server
/dev/sdd1 458G 44G 392G 10% /mysql
[root@my-server /]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 6406144 264687 6141457 5% /
tmpfs 3070273 175 3070098 1% /dev/shm
/dev/sda2 23928832 1373 23927459 1% /www
/dev/sdb1 30457856 52061 30405795 1% /web
/dev/sdc1 30457856 1995 30455861 1% /server
/dev/sdd1 30457856 793 30457063 1% /MySQL
But I wanted to know who is taking that much space and fired up disk usage and found,
[root@my-server /]# du -shx /
24G /
[root@my-server /]# du -h --max-depth=1 /
1.6G /root
4.0G /home
14M /sbin
6.5G /var
0 /misc
12K /.dbus
4.0K /mnt
4.0K /media
5.7G /dev
4.8G /opt
0 /sys
52M /user
35M /etc
0 /net
4.0K /bak
43G /mysql
6.5G /usr
du: cannot access `/proc/3633/task/25117/fd/78': No such file or directory
du: cannot access `/proc/3633/task/7047/fd/70': No such file or directory
du: cannot access `/proc/24882/task/24882/fd/4': No such file or directory
du: cannot access `/proc/24882/task/24882/fdinfo/4': No such file or directory
du: cannot access `/proc/24882/fd/4': No such file or directory
du: cannot access `/proc/24882/fdinfo/4': No such file or directory
du: cannot access `/proc/24883': No such file or directory
0 /proc
244M /lib
4.0K /nas
4.0K /selinux
4.0K /srv
27M /lib64
42G /server
49M /boot
16G /www
16K /lost+found
38G /web
100M /tmp
8.9M /bin
168G /
whoops, the actual usage being around 30GB, how do I find what files are eating my disk?
Confirming to the suspicion the culprit was a deleted file, Nothing like find or du could resolve the offending file if the file doesn't exists! well, te actual sequence of actions to find it were,
[root@my-server ~]# lsof / | grep deleted
...
java 3633 wwwuser 1w REG 8,3 66975347588 396715 /home/wwwuser/apache-tomcat-7.0.29/logs/catalina.out (deleted)
...
whoops, a 62GB file, now,
[root@my-server ~]# cd /proc/3633/fd/
[root@my-server fd]# ll | grep deleted
[root@my-server fd]# > 1
Well, the above commands I figured out from another SO answer at https://stackoverflow.com/questions/17860257/unable-to-find-large-files-in-linux-using-du-h but I was wondering wat was that last command? How did it reclaim the orphan disk space?