Feedback on UFS2 tuning for large number of small files (~100m)

Arthur Chance freebsd at qeng-ho.org
Wed Jun 8 14:16:08 UTC 2016


On 08/06/2016 11:53, Eduardo Morras via freebsd-questions wrote:
> On Wed, 8 Jun 2016 11:14:40 +0300
> Ciprian Dorin Craciun <ciprian.craciun at gmail.com> wrote:
> 
>> Hello all!  (Please keep me in CC as I'm not subscribed on the mailing
>> list.  Should I perhaps post this to the `freebsd-fs` mailing list?)
>>
>>
>> I would like your feedback on tuning a UFS2 file-system for the
>> following use-case, which is very similar to a maildir mail server.  I
>> tried to look for hints on the internet, but found nothing more
>> in-depth than enabling soft-updates, `noatime`, etc.
>>
> 
> You can use tunefs to set:
> 
> a) average file size and expected number of files per directory,
> b) check if your filesystem has any ACL flags on (NFS, POSIX, whatever) and disable them if you don't use ACLs,
> c) if filesystem is full or near full, system switch from faster writes to minimize fragmentation strategy (slower), force the fast access optimization.
> 
> They requires a umount/mount only no reformating. 
> 
> Newfs can set those values at fs formatting/createing.
> 
> There are some sysctl you can tweak, again without reformating:
> 
> vfs.ufs.dirhash_maxmem: maximum allowed dirhash memory usage

Minor point: this looks like it's dependent on the memory size. On my
32GB machine it's 27.8 MB, on my 4GB machine it's 6.5 MB, and on a 2GB
machine it's 3.3 MB.

> 
> Defaul value is 6MB. Check first dirhash usage with 
> 
> #sysctl vfs.ufs.dirhash_mem
> 
> and if it's equal or close to maxmem, grow it (24MB or more, f.ex.)
> 
> Tuning at ffs level are more tricky and risky, check sysctl vfs.ffs.*



-- 
Moore's Law of Mad Science: Every eighteen months, the minimum IQ
necessary to destroy the world drops by one point.


More information about the freebsd-questions mailing list