du-Disk Usage
df-Disk Free
[root@VM-8-12-centos /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 989M 0 989M 0% /dev
tmpfs 1000M 24K 1000M 1% /dev/shm
tmpfs 1000M 106M 894M 11% /run
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/vda1 50G 50G 0 100% /
tmpfs 200M 0 200M 0% /run/user/0
[root@VM-8-12-centos /]# du -ah --max-depth=1
4.0K ./mnt
72K ./opt
0 ./sys
4.0K ./media
0 ./lib
38M ./etc
36K ./home
105M ./boot
16K ./lost+found
6.5G ./usr
du: cannot access ‘./proc/23566/task/23566/fd/4’: No such file or directory
du: cannot access ‘./proc/23566/task/23566/fdinfo/4’: No such file or directory
du: cannot access ‘./proc/23566/fd/3’: No such file or directory
du: cannot access ‘./proc/23566/fdinfo/3’: No such file or directory
0 ./proc
0 ./bin
0 ./dev
772M ./var
106M ./run
4.0K ./data
920M ./root
0 ./lib64
0 ./sbin
4.0K ./srv
40K ./tmp
8.3G .
重启之后,OK:
[root@VM-8-12-centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 989M 0 989M 0% /dev
tmpfs 1000M 24K 1000M 1% /dev/shm
tmpfs 1000M 544K 999M 1% /run
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/vda1 50G 8.3G 39G 18% /
tmpfs 200M 0 200M 0% /run/user/0
[root@VM-8-12-centos ~]# du -ah --max-depth=1
4.0K ./.python_history
569M ./guolei
4.0K ./.cshrc
224M ./software
4.0K ./.bashrc
8.0K ./.viminfo
4.0K ./.bash_logout
89M ./.cache
4.0K ./.mysql_history
8.0K ./.pip
48K ./.bash_history
38M ./.local
4.0K ./.ssh
4.0K ./.pydistutils.cfg
8.0K ./.config
4.0K ./.tcshrc
48K ./!
4.0K ./.bash_profile
920M .
(1)当出现du和df差距很大的情况时,考虑是否是有删除文件未完成造成的,方法是lsof命令,然后停止相关进程即可。
(2)可以使用清空文件的方式来代替删除文件,方式是: echo > myfile.iso 。
(3)对于经常发生删除问题的日志文件,以改名、清空、删除的顺序操作。
(4)除了rm外,有些命令会间接的删除文件,如gzip命令完成后会删除原来的文件,为了避免删除问题,压缩前先确认没有进程打开该文件。
标签:du,删除,df,磁盘空间,0%,1000M,23566 From: https://www.cnblogs.com/emanlee/p/18463411