Inodes really tell you how many file handles (files) that can be created on a file system. Most people will never exceed the default setting when the file system is created, nor even know that one is set. I will eventually go into more detail concerning this topic here on the blog. The majority (not all) of file systems that are used on Linux and Unix do not support dynamic inode allocation. What this means is that if you exceed the inode limit of a file system before the storage space, the remainder will be un-usable. That is until some of the current files are removed.
The inode (index node) is a fundamental concept in the Linux and UNIX filesystem. Each object in the filesystem is represented by an inode. But what are the objects? Let us try to understand it in simple words. Each and every file under Linux (and UNIX) has following attributes:
=> File type (executable, block special etc)
=> Permissions (read, write etc)
=> Owner
=> Group
=> File Size
=> File access, change and modification time (remember UNIX or Linux never stores file creation time, this is favorite question asked in UNIX/Linux sys admin job interview)
=> File deletion time
=> Number of links (soft/hard)
Display File System Super Block Info
The -l option lists the inode size of the filesystem. Using the same option, other information of the filesystem superblock can also be seen. The superblock contains information about the filesystem, such as the number of free blocks available, and the number of mounts, that may be useful for tuning purposes.
#tune2fs -l /dev/sdb1
# df -i
To find the Inode Size
# sudo tune2fs -l /dev/sda2 | grep Inode
Trying to manually create a file in the folder gave me a no free space on device error but df command said the hard disk had plenty of free space. After some more research the problem resulted to be that the partition had hit the inode-max limit. This value is the max number of files that can be stored in the file system.
To check out this you can use the command "df -i" or look in /proc/sys/fs/inode-nr.
This seems to be a common problem in mail servers/proxy servers that create a lot of small files (mail messages and mail folders) since each file uses a inode.
After some research I understand that inode-max is usually three time the file-max value and that file-max value must be set according to the available ram in the server.
Techni setting 256 files per 4MB of ram to file-max, for example if we have 128MB ram then
256 * (128 / 4) = 8192
and to set it in a running server simple run
# echo "8192" >/proc/sys/fs/file-max
where value is the number obtained from the calculation. Then inode-max will be roughly 3*value that is, three times file-max.
In RedHat we can set this parameter on the /etc/sysctl.conf file so this setting is kept at every reboot of the machine.
# Improve the number of open files
fs.file-max = 8192
NOTE:
So if you are setting up a server that requires to store lots of files (mail server, http, proxy server) then you may need chose another filesystem "REISERFS FILE SYSTEM" rather than going with ext2/ext3, Because REISERFS have the inbuilt capability to handle millions of chunks of files
The inode (index node) is a fundamental concept in the Linux and UNIX filesystem. Each object in the filesystem is represented by an inode. But what are the objects? Let us try to understand it in simple words. Each and every file under Linux (and UNIX) has following attributes:
=> File type (executable, block special etc)
=> Permissions (read, write etc)
=> Owner
=> Group
=> File Size
=> File access, change and modification time (remember UNIX or Linux never stores file creation time, this is favorite question asked in UNIX/Linux sys admin job interview)
=> File deletion time
=> Number of links (soft/hard)
Display File System Super Block Info
The -l option lists the inode size of the filesystem. Using the same option, other information of the filesystem superblock can also be seen. The superblock contains information about the filesystem, such as the number of free blocks available, and the number of mounts, that may be useful for tuning purposes.
#tune2fs -l /dev/sdb1
# df -i
To find the Inode Size
# sudo tune2fs -l /dev/sda2 | grep Inode
Trying to manually create a file in the folder gave me a no free space on device error but df command said the hard disk had plenty of free space. After some more research the problem resulted to be that the partition had hit the inode-max limit. This value is the max number of files that can be stored in the file system.
To check out this you can use the command "df -i" or look in /proc/sys/fs/inode-nr.
This seems to be a common problem in mail servers/proxy servers that create a lot of small files (mail messages and mail folders) since each file uses a inode.
After some research I understand that inode-max is usually three time the file-max value and that file-max value must be set according to the available ram in the server.
Techni setting 256 files per 4MB of ram to file-max, for example if we have 128MB ram then
256 * (128 / 4) = 8192
and to set it in a running server simple run
# echo "8192" >/proc/sys/fs/file-max
where value is the number obtained from the calculation. Then inode-max will be roughly 3*value that is, three times file-max.
In RedHat we can set this parameter on the /etc/sysctl.conf file so this setting is kept at every reboot of the machine.
# Improve the number of open files
fs.file-max = 8192
NOTE:
So if you are setting up a server that requires to store lots of files (mail server, http, proxy server) then you may need chose another filesystem "REISERFS FILE SYSTEM" rather than going with ext2/ext3, Because REISERFS have the inbuilt capability to handle millions of chunks of files
No comments:
Post a Comment