# How do I determine the physical inode limit?

How do I determine the maximum number of inodes physically possible? Or is this a software limit?

I work on a GPFS file system. According to `/usr/lpp/mmfs/bin/mmlsfileset gpfs0 -i` I have a `MaxInodes = 134217728`. This is the value of a 27 bit unsigned integer, which is unconvincing. It seems like a software set limit. Is it?

• Why does it matter? Your limit would be the size of the storage you're using divided by the size of an inode and the associated data. (I'm not sure you can have an inode without data attached to it). As per the Wikipedia Article > On many types of file system implementations, the maximum number of inodes is fixed at file system creation, limiting the maximum number of files the file system can hold. A typical allocation heuristic for inodes in a file system is one percent of total size. – Seth Dec 14 '16 at 12:37
• Keep in mind, disk technology at its lowest levels uses binary progressions so just because a number is an even power of two, does not mean that it is not derived from the analog nature of the hardware. As disks become more advanced, the space used to encode info on the platter gets smaller, but as it is analog, there is always something smaller. Disk Geometry is all about slicing the disk into logical areas based on concepts like tracks, sectors, cylinders, and blocks, each of which defines general physical areas on the platters. these structures are pretty much always defined in powers of 2. – Frank Thomas Dec 14 '16 at 13:26

Inodes do not have a physical relationship to disk characteristics, except as is a side-effect of the particular file system's design.

inodes are a filesystem metadata concept, and are used to attach metadata to on-disk structures or meta-structures (like directories, which are an inode that lists inodes reflecting its contents). As such, the any limitation on inodes is based on structures created when the disk is formatted for a given filesystem type.

Space for inodes must be set aside when an operating system (or a new filesystem) is installed and that system does its initial structuring of the filesystem. Within any filesystem, the maximum number of inodes, and hence the maximum number of files, is set when the filesystem is created.

So, yes, the limit is based on software either in the OS or the file system drivers. Linux file systems generally allow the OS to play a role in determining the number of inodes when formatting a disk.

The default setting creates an inode for every 2K bytes contained in the filesystem, but the number can be adjusted by the user when creating the filesystem. For example, it can be wise to create fewer inodes when setting up a filesystem that will contain just a few large files. Similarly, for a filesystem intended for mostly small files, it is advisable to allocate more space to inodes and less to file contents.

So by default most linuxes will allocate

`ceil(formattedSizeInBytes/(2 * 1024)) => initialInodes`.

This indicates (among other things) that the count of inodes will always be an exact power of two (as both the divisor and the dividend are intrinsically powers of 2).

Now, all that said, many older file systems were designed to store a single file per sector or block, so in those cases, the number of inodes is a function of the number of sectors the disk provides (plus whatever the file system creators deemed appropriate for links and directories, etc).

GPFS is an older filesystem, but it is designed for parallel access by mainframes and supercomputers, using techniques like multi-disk striping, so it is already going to great extents to divorce its operation from the physical characteristics of individual physical disks.