2
Linux 文件系统 inode 耗尽问题解决 - 颇忒脱的技术博客
source link: https://chanjarster.github.io/post/linux/inode-exhausted/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Linux 文件系统 Inode 耗尽问题解决
线上发现服务器执行任何命令都出现这个错误:
bash: cannot create temp file for here-document: No space left on device
发现磁盘空间是够的:
df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 618M 8.8M 609M 2% /run
/dev/sda1 100G 50G 50G 1% /
...
查看 inode 用量:
Filesystem Inodes IUsed IFree IUse% Mounted on
tmpfs 459110 842 458268 1% /run
/dev/sda1 2621440 2621440 0 0% /
...
根据这个帖子的方法,检查哪个目录下的文件多:
sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
或者按照这个方法 count_em.sh
:
#!/bin/bash
# count_em - count files in all subdirectories under current directory.
echo 'echo $(ls -a "$1" | wc -l) $1' >/tmp/count_em_$$
chmod 700 /tmp/count_em_$$
find . -mount -type d -print0 | xargs -0 -n1 /tmp/count_em_$$ | sort -n
rm -f /tmp/count_em_$$
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK