1.编写测试脚本
[root@db02 home]# cat 1.sh
#!/bin/sh
i=1
while(($i < 10000000))
do
touch /boot/test/$i.txt
i=$(($i+1))
done
[root@db02 home]# sh 1.sh
2.抛出错误
touch: cannot touch ‘/boot/test/558940.txt’: No space left on device
3.查看文件系统使用率,发现系统未满,但是inode已经满了
[root@db02 home]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 8.7M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 91G 24G 68G 27% /
/dev/sda1 1014M 414M 601M 41% /boot
tmpfs 799M 0 799M 0% /run/user/0
[root@db02 home]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
devtmpfs 1018597 401 1018196 1% /dev
tmpfs 1021583 1 1021582 1% /dev/shm
tmpfs 1021583 518 1021065 1% /run
tmpfs 1021583 16 1021567 1% /sys/fs/cgroup
/dev/mapper/rhel-root 47710208 99494 47610714 1% /
/dev/sda1 524416 524416 0 100% /boot
tmpfs 1021583 1 1021582 1% /run/user/0
4.删除/boot/test下的文件,后面是反斜杠,但是网站应该不支持,详见截图。
[root@db02 home]# find /boot/test -type f -exec rm {} /;
5.遍历寻找0字节的文件,并删除。
find /boot/test -type f -size 0 -exec rm {} /;
版权声明:本文为博主原创文章,未经博主允许不得转载。
LINUX