I am quite confused about the i-nodes. They say delete files to reduce the i-nodes but I have deleted 100s of log files from different cpanels on my server but inode count is still the same.
You can determine the breakdown of your inodes on a given file system using the
You typically call
tune2fs with the
-l switch and the device you'd like to query, typically
/dev/sdb1. For my example I have a RAID device,
$ tune2fs -l /dev/md0 | grep -i inode Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Inode count: 22872064 Free inodes: 6270088 Inodes per group: 128 Inode blocks per group: 8 First inode: 11 Inode size: 256 Journal inode: 8 Journal backup: inode blocks
The above command shows the total number of inodes along with the number available.
You can use the
blkid command to get a list of your devices if you're not sure what you have.
$ blkid /dev/mapper/VolGroup00-LogVol01: TYPE="swap" /dev/mapper/VolGroup00-LogVol02: UUID="3130f689-814a-436d-8c0a-feb271c06245" SEC_TYPE="ext2" TYPE="ext3" /dev/mapper/VolGroup00-LogVol00: UUID="7a2a5b5b-8c20-4925-a359-c6574d9bc1fd" TYPE="ext3" /dev/sda1: LABEL="/boot" UUID="ed298397-2e7e-4e18-80c3-4ecd00e4cab9" TYPE="ext3" /dev/VolGroup00/LogVol00: UUID="7a2a5b5b-8c20-4925-a359-c6574d9bc1fd" TYPE="ext3" /dev/VolGroup00/LogVol01: TYPE="swap" /dev/sr0: LABEL="CentOS_5.6_Final" TYPE="iso9660"
In general, you're right - if you delete all references to the files (which could be > 0 if the files are hardlinked), the inodes should be freeed up when you delete the files.
However, if some process has the file open (like whatever process is writing to the log files), the inodes won't be freed up until that process(es) closes the files. Just as disk space used by the files isn't freed up until the files are closed.
Before deleting the files, you could have used the lsof command on the files to see if some process had the files open. Now that you've deleted the files, you could still use lsof to look at all open files on the system and search for the files that you've deleted.