UFS files in a directory limit?

Kirk McKusick mckusick at mckusick.com
Mon Mar 22 04:55:59 UTC 2010


> To: freebsd-fs at freebsd.org
> From: Ivan Voras <ivoras at freebsd.org>
> Date: Mon, 22 Mar 2010 01:08:31 +0100
> Subject: UFS files in a directory limit?
> 
> hi,
> 
> What is the limit on the number of files in a directory on UFS? I always 
> thought it is 32,767 (or near it) but now I see several directories on a 
> server with more than 36,000 files (yes it's inefficient, that's not the 
> point).

The only limit on the size of a directory is the number of files that
you can have in the filesystem. There is a limit of 2^16 directories
within a directory due to the limit on the number of hard links.

> On a similar topic, I presume there are no unexpected problems with 
> increasing vfs.ufs.dirhash_mem to ridiculous amounts like 100 MB? :)

The only issue with making vfs.ufs.dirhash_mem very large is that
you may exhaust the address space available to your kernel.

	Kirk McKusick


More information about the freebsd-fs mailing list