
오늘 VPS 중 하나에 inode가 부족했습니다.
나는 여러 개의 불필요한 작은 파일을 삭제하여 시스템이 다시 작동할 수 있도록 충분한 inode를 확보했습니다.
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/simfs 586K 529K 58K 91% /
또한 사용된 inode 수를 제공하기 위해 짧은 명령을 함께 해킹했습니다(기본적으로 모든 파일을 해당 inode 번호와 함께 나열하고 중복 항목을 필터링하고 결과 줄 수를 계산합니다).
sudo find / -xdev -type f -printf '%i~%P\n' > files.txt
<files.txt | sort -u -t'~' -k1,1 > inodes.txt
wc -l files.txt inodes.txt
1513608 files.txt
275320 inodes.txt
/
따라서 파일은 275,000개의 inode만을 설명하는 것처럼 보이지만 df
529,000개가 사용된 것으로 보고됩니다.
어떻게 그렇게 될수 있니?
(프로세스에 의해 여전히 잠겨 있는 inode를 해제하기 위해 시스템을 다시 시작했지만 사용된 inode의 양은 전혀 변경되지 않았습니다.)
답변1
대신 바인드 마운트를 사용하십시오 -xdev
. 또한 디렉토리도 inode를 사용합니다.
mkdir /mnt/somewhere
mount -o bind / /mnt/somewhere
find /mnt/somewhere -printf '%i\n' | sort -u | wc -l