Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2007 11:11:48 -0500
From:      "Rick C. Petty" <rick-freebsd@kiwi-computer.com>
To:        Francisco Reyes <lists@stringsutils.com>
Cc:        FreeBSD Filesystem <freebsd-fs@freebsd.org>
Subject:   Re: Inode density for database machines - newfs -i
Message-ID:  <20070611161148.GA19299@keira.kiwi-computer.com>
In-Reply-To: <cone.1181531481.451392.13436.1000@zoraida.natserv.net>
References:  <cone.1181531481.451392.13436.1000@zoraida.natserv.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jun 10, 2007 at 11:11:21PM -0400, Francisco Reyes wrote:
> For my mailstore machines I usually do "newfs -i 32768" to decrease fsck 
> time in case of problems.
> 
> For database machines, postgresql in particular, would it help to have a 
> number larger than 65536?

It depends on the average size of the files, which is what the inode
density refers to (actually it means "create an inode for every N bytes of
filesystem" which amounts to the same thing).  Look at the average file
size of those machines.  An easy computation can be performed by using a
combination of "df" and "find | wc".

> Looking at one of my existing database machines, I have a filesystem using 
> 1.2TB and only 2053 inodes. There are 3,539,385 free inodes. If I recall 
> correctly I used "newfs -i 65536" for that filesystem.

Then you guessed incorrectly.  Try a much larger number..  in your case you
want: "-i 20132659".  Note that specifying an inode density means newfs
will minimize the number of inodes in each cylinder group.  It tries to
create precisely the inode density you give it, but the density is adjusted
as the number of cylinder groups increases.  Basically there's a loop in
newfs which increases the number of cylinder groups until the free bitmap
for each CG can fit into a single filesystem block.  Because of that loop,
you won't always get the inode density you specify, but you will minimize
the number of inodes created.

> Will fsck be significantly faster in case of crash if I used say 
> 131072(128K)  or even 256K?

Of course, but it also depends on the number of cylinder groups.
Specifying any number for the inode density will minimize the number of
cylinder groups and also minimize the number of inodes per CG.  Both of
these will reduce fsck time.  Using a higher inode density means fewer
inodes will likely be created, meaning faster fsck time.  However, make
sure you have enough inodes for your filesystem...  running out is no fun
either.  "newfs" tells you how many inodes it creates per cylinder group
and how many CGs it creates.  Multiply the two together, and make sure that
number is larger than the number of inodes you need.  Remember:  every
directory entry and almost every file entry uses 1 inode.  Hard links don't
use an inode but each symbolic link does.

> What is the best list to find the current status of gjournal?

freebsd-geom.

> This list of geom? Looking at archives most of the gjournal posts seem to 
> be in current. 

Then that is a mistake, or it's cross-posted.

-- Rick C. Petty



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070611161148.GA19299>