一、告警现象
告警主机: 172.18.206.8 告警时间: 2021.02.27 18:45:05 告警等级: Average 告警信息: Free disk space is less than 20% on volume / 告警项目: vfs.fs.size[/,pfree] 问题详情: Free disk space on / (percentage):20 % 当前状态: PROBLEM:20 % 事件ID: 407292687
二、清理步骤
1. 通过df -h 查看磁盘空间使用情况,可以看到根目录已经使用到81%了
[root@srv-09 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 184G 147G 37G 81% / devtmpfs 32G 0 32G 0% /dev tmpfs 32G 20K 32G 1% /dev/shm tmpfs 32G 3.2G 29G 11% /run tmpfs 32G 0 32G 0% /sys/fs/cgroup /dev/sda2 465M 126M 312M 29% /boot /dev/sdb1 549G 64G 458G 13% /data tmpfs 6.3G 0 6.3G 0% /run/user/1001 tmpfs 6.3G 0 6.3G 0% /run/user/700 tmpfs 6.3G 0 6.3G 0% /run/user/0
2. 进入根目录, 可以看到/opt 目录最大
[root@srv-09 ~]# cd / [root@srv-09 /]# du -h -x --max-depth=1 37M ./etc 2.3G ./root 2.1G ./tmp 606M ./var 1.9G ./usr 279M ./home 0 ./media 0 ./mnt 122G ./opt 0 ./srv 4.0K ./script 147G .
3. 进入根目录,可以看到 backup 目录占用了37G, 可以进行清理
[root@srv-09 /]# cd /opt [root@srv-09 opt]# du -h -x --max-depth=1 0 ./rh 130M ./tcloud_dev 12M ./MegaRAID 37M ./smartstorageadmin 134M ./scripts 5.1G ./install 0 ./software 7.8G ./app 0 ./app2 0 ./app3 0 ./app4 37G ./backup 0 ./backup2 0 ./backup3 0 ./backup4 56M ./config-tool 127M ./python 68M ./sor-filebeat 44G ./skywalking-agent 1.5G ./data 60K ./fnc_recon 4.0K ./cert 46M ./shardproxy 8.6G ./wintonebak 15G ./wintone 19M ./node_exporter 122G .
4. 进行backup 目录,使用rm -rf 清理掉一些备份文件
[root@srv-09 opt]# cd backup [root@srv-09 backup]# du -h -x --max-depth=1 124M ./20201013 3.5G ./20201014 11G ./20201019 252M ./20201020 137M ./20201021 2.5G ./20201022 244M ./20201028 6.6G ./20201103 303M ./20201105 181M ./20201118 189M ./20201125 123M ./20201126 123M ./20201127 188M ./20201202 57M ./20201203 188M ./20201207 123M ./20201211 184M ./20201214 3.3G ./20201216 191M ./20201217 6.2G ./20201223 150M ./20201224 123M ./20201229 124M ./20201230 61M ./20201231 191M ./20210118 128M ./20210120 191M ./20210121 159M ./20210128 130M ./20210129 159M ./20210201 159M ./20210203 350M ./20210224 160M ./20210226 37G .