使用 df -h 查看磁盘空间占用情况
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 799M 3.1M 796M 1% /run
/dev/vda1 99G 99G 0G 100% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 799M 0 799M 0% /run/user/0
使用du -s /* | sort -nr命令查看那个目录占用空间大
9999500 /root
2711464 /usr
794104 /var
633800 /lib
263164 /home
96780 /boot
75988 /tmp
12728 /bin
7308 /sbin
4868 /etc
3132 /run
16 /lost+found
12 /media
4 /srv
4 /opt
4 /mnt
4 /lib64
0 /vmlinuz.old
0 /vmlinuz
0 /sys
0 /proc
0 /initrd.img.old
0 /initrd.img
0 /dev
然后那个目录占用多 再通过du -s /root/* | sort -nr 一层层排查,找到占用文件多的地方。我今天发现的问题是tomcat日志文件二年的都没删过。有40g,后来找到log目录删除掉了。
使用du -h --max-depth=1查看当前目录下文件夹大小情况
1.2M ./work
203M ./webapps
16K ./temp
7.4M ./lib
804K ./bin
236K ./conf
11M ./logs
224M .
如果通过以上方法没有找到问题所在,那么可以使用 lsof | grep deleted 命令,看看是否删除掉的文件仍然被进程占用而没有进行实际删除。
systemd-j 198 root txt REG 253,1 326224 1185339 /lib/systemd/systemd-journald (deleted)
systemd-l 399 root txt REG 253,1 618520 1185354 /lib/systemd/systemd-logind (deleted)
agetty 781 root txt REG 253,1 44104 664044 /sbin/agetty (deleted)
agetty 786 root txt REG 253,1 44104 664044 /sbin/agetty (deleted)
mysqld 13409 mysql 4u REG 253,1 0 918684 /tmp/ib0wMnKJ (deleted)
mysqld 13409 mysql 5u REG 253,1 100 918685 /tmp/ibQoVqHN (deleted)
mysqld 13409 mysql 6u REG 253,1 0 918686 /tmp/ib0IhuER (deleted)
mysqld 13409 mysql 7u REG 253,1 0 918687 /tmp/ibYj6KAZ (deleted)
mysqld 13409 mysql 16u REG 253,1 0 918688 /tmp/ibJb6HC3 (deleted)
mysqld 13409 12709 mysql 4u REG 253,1 0 918684 /tmp/ib0wMnKJ (deleted)
mysqld 13409 12709 mysql 5u REG 253,1 100 918685 /tmp/ibQoVqHN (deleted)
mysqld 13409 12709 mysql 6u REG 253,1 0 918686 /tmp/ib0IhuER (deleted)
mysqld 13409 12709 mysql 7u REG 253,1 0 918687 /tmp/ibYj6KAZ (deleted)
mysqld 13409 12709 mysql 16u REG 253,1 0 918688 /tmp/ibJb6HC3 (deleted)
mysqld 13409 13410 mysql 4u REG 253,1 0 918684 /tmp/ib0wMnKJ (deleted)
mysqld 13409 13410 mysql 5u REG 253,1 100 918685 /tmp/ibQoVqHN (deleted)
mysqld 13409 13410 mysql 6u REG 253,1 0 918686 /tmp/ib0IhuER (deleted)
mysqld 13409 13410 mysql 7u REG 253,1 0 918687 /tmp/ibYj6KAZ (deleted)
mysqld 13409 13410 mysql 16u REG 253,1 0 918688 /tmp/ibJb6HC3 (deleted)
mysqld 13409 13411 mysql 4u REG 253,1 0 918684 /tmp/ib0wMnKJ (deleted)
mysqld 13409 13411 mysql 5u REG 253,1 100 918685 /tmp/ibQoVqHN (deleted)
mysqld 13409 13411 mysql 6u REG 253,1 0 918686 /tmp/ib0IhuER (deleted)
mysqld 13409 13411 mysql 7u REG 253,1 0 918687 /tmp/ibYj6KAZ (deleted)
mysqld 13409 13411 mysql 16u REG 253,1 0 918688 /tmp/ibJb6HC3 (deleted)
mysqld 13409 13412 mysql 4u REG 253,1 0 918684 /tmp/ib0wMnKJ (deleted)
mysqld 13409 13412 mysql 5u REG 253,1 100 918685 /tmp/ibQoVqHN (deleted)
mysqld 13409 13412 mysql 6u REG 253,1 0 918686 /tmp/ib0IhuER (deleted)
找到占用文件很大的进程,停止进程。之后重新启动,就OK了。
标签:tmp,deleted,linux,mysql,已满,253,13409,磁盘,REG From: https://www.cnblogs.com/hefeng2014/p/18389943