[comp.unix.i386] mkfs and disk performance

fiasco@infoserv.com (Mr. Gircys) (08/16/90)

I recently had to add inodes to my news directory, and in doing
so, discovered that the system disk performance is now roughly
twice as slow as compared to the pre-inode-add file system (based
on timing expire/rnews execution).

I suspect the problem is that I used default values for "gap blocks/cyl"
parameters. Does anyone have suggestions on how to choose proper values 
for gap & blks/cyl.

My system has a 140meg scsi disk/adaptec1452 cont; the default values are
gap=9 blks/cyl=400; Esix V.3.2 Unix OS - and I've called Esix tech support
...

Any insight is welcome.

det@cimcor.mn.org (Derek Terveer) (08/21/90)

> I suspect the problem is that I used default values for "gap blocks/cyl"
> parameters. Does anyone have suggestions on how to choose proper values 
> for gap & blks/cyl.
> 
> My system has a 140meg scsi disk/adaptec1452 cont; the default values are
> gap=9 blks/cyl=400; Esix V.3.2 Unix OS - and I've called Esix tech support

I believe that he gap is the interleave on your drive.  Probably 1:1?  In the 1:1
case the gap would be 1.  For 2:1 interleave the gap is 2.

For the blks/cyl, simply take the total number of blocks on the drive and divide
by the number of cylinders.

For example, say your 140MB drive has 1208 cylinders, then without knowing the
exact number of blocks, I can guestimate that the blks/cyl would be
approximately:

			140 MB  *  2048 blks  *    1
			-------------------------------    =  237.4 blks/cyl
					 MB     1208 cyl
-- 
temporarily:  			derek@cimcor.MN.ORG
as soon as i get my pc back:	det@hawkmoon.MN.ORG

cws@janus.Quotron.com (Craig W. Shaver) (08/22/90)

In article <5.17784@infoserv.com>, fiasco@infoserv.com (Mr. Gircys) writes:
> I recently had to add inodes to my news directory, and in doing
	...
> I suspect the problem is that I used default values for "gap blocks/cyl"
> parameters. Does anyone have suggestions on how to choose proper values 
> for gap & blks/cyl.

The esix people need to revise their install script and programs to allow
for mods on the root file system during the install process.  When adding 
a second disk I modified the adddisk script (diskadd?) to stop when addparts
had been created.  (excuse any errors, this is from memory)  then I modified
the parms for the partitions file to show the correct number of cylinders and
did something else to make it use less inodes and have an interleave of 1.

On a subsequent re-install I modified the boot floppy (remove write protect,
mount it, edit INSTALL).  I wanted to allocate fewer inodes and have an
interleave of 1.  It works.

I would like to know what mkfs does with the gap?  It seems to be an anachronism
from days of pdp-11's.  I could not believe the gap/interleave I got when I
did a scsi that spoofed 64 cylinders (?) and the gap came out something like
38.  I think this will slow the system down.  If anyone knows please let me
know also.

	Craig W. Shaver

================================================================
Quotron Systems Inc.    | Phone: (213) 302-4247
5454 Beethoven Street   | uucp: trwrb!scgvaxd!janus!cws
Post Office Box 66914	| craig@tradr2.quotron.com
Los Angeles, CA 90066   |
================================================================

dag@fciva.FRANKLIN.COM (Daniel A. Graifer) (08/23/90)

In article <1990Aug21.050638.15737@cimcor.mn.org> det@cimcor.mn.org (Derek Terveer) writes:
>
>I believe that he gap is the interleave on your drive.  
>

I believe this is incorrect.  The interleave is the physical numbering
modulus for sectors on your drive.  This a function of drive controller/
format.

The 'gap' is parameter of the file system, and tells the file system how
to map 'contiguous' logical blocks of filespace to physical blocks.  Since
the standard file system buffers reads one block at a time, proper
gapping will cause a set of sequential reads to synchonize efficiently
with the availability of physical blocks on the drive.

Some of the newer 'fast file systems' do 'Block Bundled I/O (BBIO)'.  Our
vendor (Prime Computer) added this, and had us re-mkfs all of our partitions
with gap 1.  On files opened for sequential read, the file system attempts to
cache multiple blocks whenever a physical read occurs, which will only 
speed things up if sequential blocks of the file can be loaded in a single
contiguous read.

Our system was delivered with a number of utilites in /usr/lbin which the
system administration menus use to determine the cyl/gap parameters.  The
program that has been distributed on the net 'fsanalyze' (We got our copy
off of uunet) will tell you more about how your file systems are structured.

All of the above is my interpretation of the manuals combined with comments
from Prime, and examining fsanalyze output.  I make no guarantees about the
accuracy of my comments.

Dan
-- 
Daniel A. Graifer			Franklin Mortgage Capital Corporation
uunet!dag@fmccva.franklin.com		7900 Westpark Drive, Suite A130
(703)448-3300				McLean, VA  22102

pb@idca.tds.PHILIPS.nl (Peter Brouwer) (08/24/90)

 In article <536@fciva.FRANKLIN.COM> dag@fciva.UUCP (Daniel A. Graifer) writes:
>In article <1990Aug21.050638.15737@cimcor.mn.org> det@cimcor.mn.org (Derek Terveer) writes:
>>I believe that he gap is the interleave on your drive.  
>I believe this is incorrect.  The interleave is the physical numbering
>modulus for sectors on your drive.  This a function of drive controller/
>format.
>
>The 'gap' is parameter of the file system, and tells the file system how
>to map 'contiguous' logical blocks of filespace to physical blocks.  Since
>the standard file system buffers reads one block at a time, proper
>gapping will cause a set of sequential reads to synchonize efficiently
>with the availability of physical blocks on the drive.

To be precise, the gap determines the way the free block space is organised.
There is a pitfall however. The gap size specified for mkfs and fsck 
is related to 512 disk sector size. The first thing mkfs and fsck does is 
determine the unix blocksize and recalculate the gap value.
So if you specify a gap of 4 for a 1024 byte block file system the logical
gap value used will be 2.

Here is an example: lets asume the gap value is 4 and there are 20 blocks.
Then the folowing sequence will be used in the free block list.
0 3 7 11 15 19 4 8 12 16 1 5 9 13 17 2 6 10 14 18

So when a file is created on the file system free block are taken in sequence
from the free block list and the file has the same gap in the block sequence
as is used in the free block list.
Now when a file is removed the blocks are put at the begin of the free block
list. This will disturb the organisation of the free block list. So if this
is going on for a lost of files with different sizes the free block lists
and the new created files get fragmented. The only way to defragment a file
system with the 'standard tools' is to copy the filesystem to a new created
file system. There are however a few 'defragment tools'. There was one 
posted on the net about a year ago. This one could would created new
files with a gap of 1.

An other approach would be to use fsck at regular intervals to recreate the
free block list. Fsck will then create a new block list with blocks in the
correct sequence. This will not defragment the already excisting files.
I have forced a fsck on each monday during the boot process of the machine.

I hope this will help to clear things up a bit.
-- 
Peter Brouwer,                # Philips Information Systems,
NET  : pb@idca.tds.philips.nl # Department SSP-P9000 Building V2,
UUCP : ....!mcsun!philapd!pb  # P.O.Box 245, 7300AE Apeldoorn, The Netherlands.
PHONE:ext [+31] [0]55 432523, # 

jim@segue.segue.com (Jim Balter) (08/29/90)

In article <628@ssp2.idca.tds.philips.nl> pb@idca.tds.philips.nl (Peter Brouwer) writes:
>To be precise, the gap determines the way the free block space is organised.

That is neither precise nor correct.  The gap is the rotational gap,
which is the offset between the logical track start from one track to another.
This offset is to account for track-to-track seek time; if it is just right,
the next block will be under the read head just as it settles over the track. 
It has nothing to do with free space, unless your system has taken this value
over for something other than its original purpose.  The gap was important
back when UNIX ran off of RK05's; modern disk controllers should optimize
track formatting for contiguous I/O.

jim@segue.segue.com (Jim Balter) (08/31/90)

In article <3295@segue.segue.com> jim@segue.segue.com (me) writes:
>That is neither precise nor correct.  <wrong explanation ...>

I must be suffering brain rot.  I was precise, but not correct.  I was
describing something, but it wasn't a mkfs parameter.  mkfs takes two numbers,
the interleave factor and the number of block per cylinder, which lets mkfs
interleave the blocks on each cylinder.  These numbers are used to initialize
the free space list.  My apologies for contributing to the abundance of false
information on the net.