During installation of CentOS 6 I would like to set the number of inodes created on the ext4 partitions. Is there a way to do this? I have been unable to locate a solution.

Example use case: I know I am going to have a 120GB disk and I am going to mount it at /var however I have an application that writes a absolute ton of files so I must increase the inodes at install/setup. Therefore I want to pass in a more appropriate inode size at install. So I do not run into 40% disk usage and 100% inode usage.

Thanks in advance!

  • Out of curiousity, just exactly how many is "tons"? I've dealt with enterprise data remediation apps that were about 1 million/hour, but we made sure it was well-written enough to clean up after itself. And if those are logs files, why isn't it going through syslog or a splunk or centralized syslog setup to control that? – Magellan May 6 '12 at 22:39
  • @Adrian, "tons" was fairly non-descriptive; sorry about that. It is about 5.4million files over approximately 80GB of disk space. The inodes get chewed up quickly with that ratio. – Chris Schuld May 6 '12 at 22:49
  • Ah. That is a bit annoying. That's not all that much more than the file count in our Cyrus IMAP filestore. And while that partition consumes 3x of your planned consumptionm, we've never come remotely close to bumping the default inode count limit either. – Magellan May 6 '12 at 23:01
  • Caveat: Do not try to save on wasted space for small files by setting the filesystem blocksize lower than the default. This a) sometimes gets you terrible performance, b) on ext filesystems will get you an unexpectedly low limit on files per directory (IIRC I hit a few ten or hundred thousand once with 1k blocks) which might or might not cause problems with your layout. Hope this is not too offtopic, it might well bite you when planning filesystems for that kind of app. – rackandboneman May 6 '12 at 23:10

Well, one obvious solution is to just leave the partition that you want to use as /var as unallocated space during install (use the custom/manual disk layout option to get Disk Druid or whatever it is now). After installation, mkfs using whatever inode options you want, add it to /etc/fstab, and you're good to go.

  • thanks, I am actually trying this now as I realized this might be the only solution especially after your comment/answer. I was attempting to do it all at once and realized this is such a 1% user problem the coverage in the setup tool is likely not going to touch it. – Chris Schuld May 6 '12 at 22:50
  • Yeah, I haven't done a CentOS6 install yet (yay, VPS images by the provider!), but I don't recall fine control of mkfs options with the disk partitioning options on the installer in earlier CentOS iterations. – cjc May 6 '12 at 22:56

It should be pretty easy to do this once manually, as cjc suggests, but I assume that you're wanting to do this a number of times, otherwise you would have just done it.

If you use Kickstart, you can specify a filesystem usage type in the "part" declaration by using the --fsprofile flag. Usage types are actually built into mke2fs and are controlled by /etc/mke2fs.conf. Check out their man pages for more info. It would be nice if Kickstart would allow you to just pass arbitrary options to the mkfs command, but it doesn't appear to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.