演示inode耗尽系统提示空间不足场景
测试环境准备 挂载一个10M大小的tmpfs到 /mnt
[root@localhost tmp]# mount -t tmpfs none /mnt/ -o size=10M
[root@localhost tmp]# cd /mnt/
[root@localhost tmp]# df -hT /mnt/
Filesystem Type Size Used Avail Use% Mounted on
none tmpfs 10M 0 10M 0% /mnt
[root@localhost mnt]# df -i /mnt
Filesystem Inodes IUsed IFree IUse% Mounted on
none 124747 1 124746 1% /mnt
#创建大量空文件耗尽inode
[root@localhost mnt]# echo file{1..124747} | xargs touch
touch: cannot touch ‘file124747’: No space left on device
[root@localhost mnt]# df -i /mnt
Filesystem Inodes IUsed IFree IUse% Mounted on
none 124747 124747 0 100% /mnt
[root@localhost mnt]# df /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
none 10240 0 10240 0% /mnt
[root@localhost mnt]# touch 1.txt
touch: cannot touch ‘1.txt’: No space left on device
#inode耗尽 无法创建空文件
[root@localhost mnt]# \cp -v /etc/man_db.conf file1
‘/etc/man_db.conf’ -> ‘file1’
#数据空间还有剩余 所以可以把数据写入空文件中
[root@localhost mnt]# df /mnt/
Filesystem 1K-blocks Used Available Use% Mounted on
none 10240 8 10232 1% /mnt
删除测试文件,卸载 /mnt
[root@localhost mnt]# find ./ -name "file*" | xargs rm -f
[root@localhost mnt]# ls
[root@localhost mnt]# cd /tmp/
[root@localhost tmp]# umount -v /mnt
umount: /mnt (none) unmounted