天天看點

root檔案系統即使是在重新開機之後也是依然100%,并且找不到相應的檔案

參考自如下文章:

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下是有隐藏檔案的。
           

繼續閱讀