Summary of How to increase no. of inodes per partition

From: Mahesh Kumar (
Date: Thu Mar 29 1990 - 15:30:23 CST

Thanx to all who replied re: the problem below

>> PROBLEM --> newfs and mkfs both pay no attention to the nbpi (no. of bytes
>> per inode) parameter. It always createsa filesystem with 2048 b/i .

        The problem is thatthe number of inodes per cylinder group is
a constant ( = 2048 as defined by MAXIPG in ufs/fs.h). In small partitions
on large disks, since the number of cylinder groups is small (large disk
=> large no of sectors per track (usualy) => large number of sectors per
cylinder, etc.) the number of inodes per partition is small. Obviously,
to increase the number of inodes per partition, the number of cylinder
groups needs to be increased.
        To increase the no. of cylinder groups, decrease the number of
cylinders per group. This is not trivial however. One has to use the
formula --

    minimum no. of cylinder's per group == 16/(2**X)

        where (2**X) is the largest factor of sectors/cylinder
                where sectors/cylinder = sectors/track * tracks/cylinder
Obviously, X > 4 is identical to X==4 (else no. of cyl./group < 1 !!)

        Don't ask me why this is the case. I went thru' the BSD
code for mkfs, and they do real neat stuff with shifts and carries.

        disk has 67 sectors/track, and 27 tracks/cylinder.
        no. of sectors/cyl. == 67 * 27 == 1809
        for integer value of 1809/(2**X), X == 0
        therefore, minimum no. of cyl./group == 16

Lets waste one sector per track.
        disk now has 66 sectors/track, and 27 tracks/cyl.
        no. of sectors/cyl. == 66*27 == 1782
        for integer value of 1782/(2**X), X == 1
        therefore, minimum no. of cyl./group == 16/2 == 8
        hence, since no. of cylinder groups doubled, no. of inodes
                doubled !!

Similiarly, by wasting 3 sectors per track, we can have X == 3,
        and have down to 2 cyl./group

To put changes into effect, find the values that you use for sectors/track,
tracks/cylinder, and the size of the file system (I use newfs -v), and
then modify sectors/track to give you the appropriate cyl./group. Remember
to recalculate the file system size after modifying sectors/track.

Many thanx to all those who replied, including
an NEC BugTraq report
and a sun tech support guy

Mahesh Subramanya
Office of Univeristy Computing
Univeristy of Notre Dame
Notre Dame, IN 46556

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:05:56 CDT