参考自如下文章:
https://access.redhat.com/solutions/92763
The root filesystem is 100% full while an fsck and reboot has no effect
如下是实验过程:
首先是造一个这样的场景:
[[email protected] ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
[[email protected] ~]# uname -r
2.6.32-642.el6.x86_64
[[email protected] ~]# pwd
/root
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 95G 61G 29G 69% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 33M 147M 19% /boot
[[email protected] ~]# mkdir /lei
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 95G 61G 29G 69% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 33M 147M 19% /boot
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 95G 67G 23G 75% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 33M 147M 19% /boot
---->此时,通过ftp,上传一个文件到/lei下,“cn_windows_server_2016_x64_dvd_9718765.iso”,5.75GB大小。
[[email protected] ~]# cd /lei
[[email protected] lei]# du -x
6031700 .
[[email protected] lei]# du -smx
5891 .
[[email protected] lei]# du -shx
5.8G .
[[email protected] lei]#
[[email protected] lei]# ls -lrt
total 6031696
-rw-r--r-- 1 root root 6176450560 Mar 5 23:21 cn_windows_server_2016_x64_dvd_9718765.iso
[[email protected] lei]#
[[email protected] lei]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 95G 67G 23G 75% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 33M 147M 19% /boot
[[email protected] lei]#
[[email protected] lei]# pwd
/lei
[[email protected] lei]# mount /dev/cdrom /lei
mount: block device /dev/sr0 is write-protected, mounting read-only
[[email protected] lei]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 95G 67G 23G 75% / ----->>>>注意此处的23GB,这是减去“cn_windows_server_2016_x64_dvd_9718765.iso”5.75GB之后的剩余空间。
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 33M 147M 19% /boot
/dev/sr0 3.7G 3.7G 0 100% /lei
[[email protected] lei]#
[[email protected] lei]# find / -size +999999999c
/home/oracle/p13390677_112040_Linux-x86-64_2of7.zip
/home/oracle/p13390677_112040_Linux-x86-64_1of7.zip
/root/p13390677_112040_Linux-x86-64_2of7.zip
/root/test
/root/FileRecv/app20122_ora_14258/app20122_ora_14258.trc
/root/p13390677_112040_Linux-x86-64_1of7.zip
find: `/proc/2398/task/2398/fd/5': No such file or directory
find: `/proc/2398/task/2398/fdinfo/5': No such file or directory
find: `/proc/2398/fd/5': No such file or directory
find: `/proc/2398/fdinfo/5': No such file or directory
[[email protected] lei]#
---->>>上面的find命令是查出来文件大小大于1G的文件,从结果上可以看到,没有体现出“cn_windows_server_2016_x64_dvd_9718765.iso”
---->>>总结:在mount /lei之前,lei作为/下的一个文件夹,在该文件夹下是有文件的。
---->>>后来,mount /lei之后,lei变成了一个mount point,在lei文件夹下的文件通过find命令也是找不出来的。
---->>>这就造成了"文件系统的已使用空间变大,但是找不到对应大文件”的现象。
下面来解决该问题:
[[email protected] ~]# mkdir /root_bind
[[email protected] ~]# mount --bind / /root_bind
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 95G 67G 23G 75% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 33M 147M 19% /boot
/dev/sr0 3.7G 3.7G 0 100% /lei
[[email protected] ~]# du -smx /root_bind/* ---->>>记下下面每一行的输出,与下一个命令的输出做对比
10 /root_bind/bin
1 /root_bind/boot
1 /root_bind/cgroup
365 /root_bind/data
1 /root_bind/dev
34 /root_bind/etc
13671 /root_bind/home
5891 /root_bind/lei -------->>>>5891MB
201 /root_bind/lib
28 /root_bind/lib64
1 /root_bind/lost+found
1 /root_bind/media
1 /root_bind/misc
1 /root_bind/mnt
1 /root_bind/net
2 /root_bind/opt
1 /root_bind/proc
45650 /root_bind/root
1 /root_bind/root_bind
17 /root_bind/sbin
1 /root_bind/selinux
1 /root_bind/srv
1 /root_bind/sys
1 /root_bind/tmp
2137 /root_bind/usr
131 /root_bind/var
[[email protected] ~]# du -smx /* ---->>>记下下面每一行的输出,与上一个命令的输出做对比
10 /bin
32 /boot
1 /cgroup
365 /data
1 /dev
34 /etc
13671 /home
3753 /lei -------->>>>3753MB
201 /lib
28 /lib64
1 /lost+found
1 /media
0 /misc
1 /mnt
0 /net
2 /opt
du: cannot access `/proc/2420/task/2420/fd/4': No such file or directory
du: cannot access `/proc/2420/task/2420/fdinfo/4': No such file or directory
du: cannot access `/proc/2420/fd/4': No such file or directory
du: cannot access `/proc/2420/fdinfo/4': No such file or directory
0 /proc
45650 /root
68129 /root_bind
17 /sbin
1 /selinux
1 /srv
0 /sys
1 /tmp
2089 /usr
131 /var
[[email protected] ~]#
至此,找到了lei 这个mount point下是有隐藏文件的。