演示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