一、df -h命令查看
通过df -h
命令查看硬盘的使用情况:发现/dev/vda1 挂载点已经满了
[root@zabbix_server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 40G 0 100% /
devtmpfs 858M 0 858M 0% /dev
tmpfs 868M 0 868M 0% /dev/shm
tmpfs 868M 516K 867M 1% /run
tmpfs 868M 0 868M 0% /sys/fs/cgroup
tmpfs 174M 0 174M 0% /run/user/0
二、查找服务器中的大文件
1、从根目录开始查找,通过du -h --max-depth=1
命令,发现是root目录占用空间较多
[root@zabbix_server /]# du -h --max-depth=1
4.0K ./srv
4.0K ./mnt
2.5G ./usr
516K ./run
281M ./home
34M ./etc
331M ./var
80M ./tmp
du: cannot access ‘./proc/18199/task/18199/fd/4’: No such file or directory
du: cannot access ‘./proc/18199/task/18199/fdinfo/4’: No such file or directory
du: cannot access ‘./proc/18199/fd/3’: No such file or directory
du: cannot access ‘./proc/18199/fdinfo/3’: No such file or directory
0 ./proc
0 ./dev
36G ./root
0 ./sys
813M ./opt
16K ./lost+found
4.0K ./media
132M ./boot
40G .
2、cd ./root
,然后 通过du -h --max-depth=1
命令依次往下查找,最后发现是test.log占用空间较大
[root@zabbix_server ~]# du -h test.log
36G test.log
[root@zabbix_server ~]#
三、定位到了问题,删掉此文件即可
[root@zabbix_server ~]# rm -rf test.log
[root@zabbix_server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 4.2G 34G 12% /
devtmpfs 858M 0 858M 0% /dev
tmpfs 868M 0 868M 0% /dev/shm
tmpfs 868M 516K 867M 1% /run
tmpfs 868M 0 868M 0% /sys/fs/cgroup
tmpfs 174M 0 174M 0% /run/user/0
[root@zabbix_server ~]#
=============磁盘空间已释放=================