Linux inode full solution, linuxinode
Solution to linux inode full
Today, a login server website finds that no session is generated after login. Based on past experience, it is generally because the space is full and the session file generation fails.
df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/dev01-root 75G 58G 14G 82% /udev 2.0G 4.0K 2.0G 1% /devtmpfs 396M 292K 396M 1% /runnone 5.0M 0 5.0M 0% /run/locknone 2.0G 4.0K 2.0G 1% /run/shm/dev/sda1 228M 149M 68M 69% /boot
14 GB space remaining. Another cause of file generation failure is that the inode of the file index node is full.
df -iFilesystem Inodes IUsed IFree IUse% Mounted on/dev/mapper/dev01-root 4964352 4964352 0 100% /udev 503779 440 503339 1% /devtmpfs 506183 353 505830 1% /runnone 506183 5 506178 1% /run/locknone 506183 2 506181 1% /run/shm/dev/sda1 124496 255 124241 1% /boot
Inodes occupies 100%, which is indeed a problem.
Solution:Delete useless temporary files and release inode.
Find and find many session temporary files in the/tmp directory.
ls -lt /tmp | wc -l4011517
Go to the/tmp directory and run the find-exec command.
sudo find /tmp -type f -exec rm {} \;
If rm * is used, the Argument list too long error may occur due to the large number of files. For details about the Argument list too long error, refer to linux Argument list too long error solution.
In addition to the temporary/tmp files, 0-byte files also occupy inode and should also be released.
Search for 0-byte files and delete them.
sudo find /home -type f -size 0 -exec rm {} \;
After deletion, inode usage is reduced to 19% and can be used normally.
df -iFilesystem Inodes IUsed IFree IUse% Mounted on/dev/mapper/dev01-root 4964352 940835 4023517 19% /udev 503779 440 503339 1% /devtmpfs 506183 353 505830 1% /runnone 506183 5 506178 1% /run/locknone 506183 2 506181 1% /run/shm/dev/sda1 124496 255 124241 1% /boot