[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: inode limit ?



On Oct 25, 2001  12:49 -0400, Bryan-TheBS-Smith wrote:
> Douglas Brunton wrote:
> > 27 gig ext3 / partition.  The problem that I am experiencing
> > is this:  If I create more than (about) 3.5 million distinct
> > files on the partition, touch, mkdir, cp and all other file
> > creation methods complain that there is no available space on
> > the disk.
> 
> Let's see here, 27GB w/1 node per 8KB (default) = 3.5M inodes.

Yes, just to emphasize, if you create files with an average size of
less than 8kB, you will run out of inodes before you run out of
blocks.  Since this is an unusual situation, most people don't have
such a problem.

> > In the 2.2 kernel there was a way to adjust the max-inodes
> > at runtime by adjusting the values in /proc/sys/fs/max-inodes
> > file, but I don't see this file with the 2.4.7-10 kernel that
> > shipped with 7.2 (and I can't create it, even as root).
> 
> I was under the impression that on Ext2 (and Ext3), inodes were
> pre-allocated?  And you must specify additional inodes as
> mkfs-time???

Correct.

> I think your filesystem needs to be reformatted with additional
> inodes.  Unless, of course, newer Ext2/Ext3 versions can re-allocate
> them?

Yes, unfortunately, there is not much that can be done in this case.
If you know that the average file size will remain this small (e.g.
a news spool), you need to rebuild the filesystem with more inodes
(doing a backup/restore if the files are important). There are several
ways to specify more inodes at filesystem creation time:

	mke2fs -i 4096 <dev>	# one inode per 4kB instead of default 8kB
	mke2fs -N 4000000 <dev>	# create at least 4M inodes
	mke2fs -T news <dev>	# same as using -i 4096

If your average filesize is much less than 4kB, you could also use smaller
disk blocks to store them more compactly:

	mke2fs -b 2048 -i 2048 <dev>	# average filesize <= 2kB
	mke2fs -b 1024 -i 1024 <dev>	# average filesize <= 1kB

Note that with so many small files in such a large disk, you may have
performance problems if there are lots of files in a single directory
(the indexed-directory patch is not in ext2 or ext3 yet).  I hate to
say it, but depending on what you are doing, you may be better off in
this case to use reiserfs.  It is a bit less reliable than ext3 (IMHO)
but handles strange setups like this better.

Cheers, Andreas
--
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]