doubling the number of inodes on a partition

Mark Verber verber at pacific.mps.ohio-state.edu
Fri Feb 22 09:16:46 AEST 1991


Sigh...

yes, newfs on SunOS 4.0.3 is busted.  Under anything later than SunOS
4.0.3 (eg 4.1, 4.1.1) newfs does work, and all you have to do is
specify your preferred bytes/inodes with the -i flag.  If you are
going to continue running 4.0.3 for awhile you have do something a bit
more ugly.  Here are the basic instructions.

The problem is that you can't tell mkfs directly how many inodes to
create.  It figures the number for itself.  There are about 5 numbers
that interact.  Unfortunately, several of them have maximum or minimum
values, so you don't even get to specify them.  Altogether, it looks
like mkfs was designed to make it as hard as possible to increase the
number of inodes.

In theory, you should be able to specify more than the usual number of
inodes per cylinder group.  However in practice it generally seems to
be sitting at 2048, which is the maximum value.  So attempts to
increase it are ignored.

Since you can't increase the umber of inodes / cylinder group, you
have to increase the number of cylinder groups.  This is computed from
the cylinders per cylinder group.  So you have to decrease the number
of cylinders per cylinder group.  This is an argument to mkfs, so in
some cases you can just specify it as 4 or 8.  I've actually gotten
this to work sometimes.  Unfortunately, sometimes mkfs won't let you
specify anything less than 16.

Now things get hairy.  The way mkfs computes the minimum number of
cylinders per group is sort of odd.  It gets initialized to 16 (at
least for the disks I've seen).  Then a loop is done which divides
both cylinders per group and sectors per cylinder by 2, until sectors
per cylinder is odd.  If the number of sectors per cylinder starts out
odd, of course this loop stops immediately, and you get 16 cylinders
per group.  I managed to fix things up by telling mkfs not to use all
the sectors on a track.  In case this isn't obvious, what I'm doing is
telling mkfs to ignore some of my disk space.  The number that needs
to be even is sectors per cylinder, which is of course sectors per
track times tracks per cylinder.

In your case

  /dev/rxd0e:     175874 sectors in 175 cylinders of 15 tracks, 67 sectors

15 * 67 is 1005 sectors per cylinder.  This is odd, so you're stuck.
If you specify 66 instead of 67, you get 990, which is even.  So you
get to specify 8 cylinders per group, and double your inodes.  If you
need more, specify 64.  15 * 64 is divisible by 4 (also, 8, 16, ...),
so you should be able to specify 4 cylinders per group, and quadruple
your inodes.  At the cost of space of course.  You may be able to
specify 2 or 1 also.  I don't recall if some other bound eventually
comes into play.

When you play this game, you'll also have to reduce the number of
sectors in the partition.  newfs computed 175874 sectors for the
partition based on 175 * 15 * 67.  When you tell mkfs not to use some
of the sectors, of course you'll have less space, so this number will
be smaller.  E.g. if you use 64 sectors per track, it will be 175 * 15
* 64.

There's got to be a better way.



More information about the Comp.unix.admin mailing list