{"id":61693,"date":"2021-08-04T09:21:00","date_gmt":"2021-08-04T14:21:00","guid":{"rendered":"https:\/\/blog.cpanel.com\/?p=61693"},"modified":"2021-08-04T09:21:00","modified_gmt":"2021-08-04T14:21:00","slug":"how-to-manage-inode-quotas-and-control-inode-usage","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/general-knowledge\/how-to-manage-inode-quotas-and-control-inode-usage\/","title":{"rendered":"How to Manage Inode Quotas and Control Inode Usage"},"content":{"rendered":"\n

The CentOS operating system has several features that restrict users’ resource consumption. They help web hosts and server administrators to fairly distribute resources on shared servers and to create tiered account systems. Without quotas, rogue users can\u2014accidentally or deliberately\u2014use more than their fair share, hurting their neighbors’ web hosting performance.<\/p>\n\n\n\n

Inode quotas limit the number of files a user can create. In this article, we explore what inodes are, how to display inode quotas in cPanel, how to create inode quotas on the command line, how to automate quotas with cPanel & WHM\u2019s standard hooks system.<\/p>\n\n\n\n

What Are Inodes?<\/strong><\/h2>\n\n\n\n

Inode is short for index node, the filesystem metadata that stores information about each file and where it is. Every file and directory has an inode that contains ownership details, permissions, the file\u2019s size, the filetype, and pointers to its data. The contents and structure differ by filesystem, but inodes play a similar role in all Unix filesystems.<\/p>\n\n\n\n

Because every file has an inode, enforcing an inode quota is the same as enforcing a limit on the number of files. Inode quotas don\u2019t control the amount of data a user can store in their home directory; they put an upper limit on the number of files, not the size.<\/p>\n\n\n\n

In the past, inode quotas were essential because each filesystem had a fixed quantity determined when the disk volume was formatted. If users generated too many files, they could use all the inodes, making it impossible to create new files. This was a common occurrence on email servers with inboxes that contain many small files. However, beginning with CentOS 7\u2019s release in 2014, the default filesystem is XFS, which allocates inodes dynamically\u2014you can\u2019t run out of inodes.<\/p>\n\n\n\n

However, large numbers of files create other problems. They can degrade hard drive performance and increase memory consumption. Additionally, each inode consumes a small amount of disk space, by default 512 bytes on XFS. In rare circumstances, a user could generate so many files they fill the volume with inodes, leaving no space for data. This usually only happens when buggy scripts autogenerate billions of tiny or empty files, but it\u2019s a risk that should be guarded against.<\/p>\n\n\n\n

Displaying Inode Usage In cPanel<\/strong><\/h2>\n\n\n\n

You can inform cPanel users of their inode limits with the Statistics sidebar\u2019s File Usage feature. It displays both used inodes and available inodes, allowing users to manage file numbers when they approach their limit.<\/p>\n\n\n\n

The File Usage feature isn\u2019t displayed by default, but server administrators can activate it in WHM. Select Tweak Settings<\/em> under Server Configuration<\/em> in the WHM sidebar menu. Enter \u201cinode\u201d in the search box, and activate the Display File Usage information in the cPanel stats bar (inode count)<\/em> tweak.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Reducing Inode Usage<\/strong><\/h2>\n\n\n\n

cPanel users approaching their inode quota limit can free inodes by deleting files. There are two types of inode quota: soft and hard. If you exceed your soft quota, you will still be able to create files. If you exceed your hard quota, you will not. Many of your hosting account\u2019s features need to generate files. If you hit the hard limit, you won\u2019t be able to add new web pages, receive emails, install software, or many other common tasks.<\/p>\n\n\n\n

It\u2019s better to reduce inode usage by deleting files long before you hit the hard limit. You can remove files by:<\/p>\n\n\n\n