磁盘空间已满,但是找不到占用空间的文件,整个故障排除过程如下:
[root@localhost opt]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 9.5G 6.1G 3.0G 68% /
tmpfs 24G 228K 24G 1% /dev/shm
/dev/sda1 190M 34M 146M 19% /boot
/dev/sda8 24G 44M 23G 1% /data
/dev/sda2 212G 50G 152G 25% /home
/dev/sda6 9.5G 8.2G 901M 91% /opt
/dev/sda7 9.5G 293M 8.8G 4% /var
[root@localhost opt]# du -sh /opt/*
556M /opt/buildirm
16K /opt/lost+found
4.0K /opt/rh
[root@localhost opt]# df -i /opt
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda6 640848 184516 456332 29% /opt
[root@localhost opt]# ls -al
总用量 40
drwxrwxrwx. 6 root root 4096 12月 16 09:46 .
dr-xr-xr-x. 29 root root 4096 4月 28 09:44 ..
drwxrwxrwx. 4 root root 4096 9月 16 2015 buildirm
-rw-------. 1 root root 39 12月 16 09:46 .directory
drwx------. 2 root root 16384 5月 8 2015 lost+found
drwxr-xr-x. 2 root root 4096 5月 17 2013 rh
drwx------. 4 root root 4096 9月 17 2015 .Trash-0
[root@localhost opt]# du --max-depth=1 -lh /opt
16K /opt/lost+found
4.0K /opt/rh
7.6G /opt/.Trash-0 //终于找出占用磁盘空间的罪魁祸首了!
556M /opt/buildirm
8.1G /opt
[root@localhost opt]# du --max-depth=1 -lh --all /opt
16K /opt/lost+found
4.0K /opt/rh
7.6G /opt/.Trash-0
556M /opt/buildirm
4.0K /opt/.directory
8.1G /opt
本文转自 linuxzkq 51CTO博客,原文链接:http://blog.51cto.com/linuxzkq/1785246