SUMMARY: Disk performance and space tuning

From: Jay Plett (jay@silence.princeton.nj.us)
Date: Thu Feb 28 1991 - 23:49:48 CST


A while back, Jiri Dvorak <dvorak@iam.unibe.ch> observed:
> In SunOS 4.1.1, newfs creates per default a lot more inodes than in 4.0.3 or
> earlier versions.
and asked about the advisability of creating filesystems with
fewer inodes (which you can do with SunOS 4.1*). He has posted
the response he received.

I asked a related question. Suninstall apparently runs newfs
with no options. The result is that any filesystems that you
let suninstall run newfs on will shrink when upgrading to 4.1*
from a previous release (because of the space consumed by the
added inodes). This is unnecessary and wasteful, especially in
the case of filesystems like /usr which are static but wind up
with an enormous overabundance of inodes and a loss of 3-5% in
usable space. I asked how one can avoid this.

After you've run suninstall, there's no alternative but to dump
a filesystem, newfs it with fewer inodes, and restore it. Doing
this for / or /usr is, of course, a non-trivial undertaking.

The better approach is to build your filesystems before running
suninstall. After loading the miniroot onto your swap partition,
use format to make any necessary adjustments to your partitions
(the installation manual describes using format; the System
Administration Manual chapter on format describes partitioning
and labelling). Then create your filesystems with newfs, using
the -i option to obtain the desired number of inodes (see the
man page for newfs). Finally, run suninstall. In the menu
where you set up your disks, select the option labelled "edit
existing". Then, simply fill in the mount-point names and type
"y" in the "preserve" column. Suninstall will not run newfs on
any partitions so marked.

This requires a little advance planning. The -i option to newfs
specifies bytes/inode. To obtain estimates of the best values,
use "df" and "df -i" on your existing partitions before upgrading.
Divide the "used" column of "df" by the "iused" column of "df -i"
and multiply the result by 1024. This will tell you the number of
bytes/inode this disk partition currently uses--a good basis for
predicting future needs. I'm sure there is some rounding or
truncation involved when mkfs converts bytes/inode to inodes/
cylinder group. Best to err a bit on the conservative side.

As an example, I used "newfs -i 8192" for /usr on a Sun4 when
installing 4.1.1. The result after installation:
        <ee> df /usr
        Filesystem kbytes used avail capacity Mounted on
        /dev/xd4g 160222 121397 22802 84% /usr
        <ee> df -i /usr
        Filesystem iused ifree %iused Mounted on
        /dev/xd4g 12989 7683 63% /usr
        <ee> dkinfo xd4g | grep ' sectors '
        326190 sectors (262 cyls)

For comparison, here's what happened when I left it to suninstall
on another Sun4:
        <astro> df /usr
        Filesystem kbytes used avail capacity Mounted on
        /dev/id000g 147951 141851 0 107% /usr
        <astro> df -i /usr
        Filesystem iused ifree %iused Mounted on
        /dev/id000g 14310 59418 19% /usr
        <astro> dkinfo id000g | grep ' sectors '
        314880 sectors (256 cyls)

The yield of usable disk space on astro, with the default newfs
parameters, was 147951/314880*1024 = 481.14 bytes/sector. On ee,
with "-i 8192", the yield was 160222/326190*1024 = 502.98 bytes/
sector. The advantage is 4.5%. The procedure is really very quick
and easy; if your disk space is tight enough that 3-5% matters, it
is worthwhile. It can make a bigger difference on partitions like
/export/swap, where very few inodes are needed.

        Jay Plett
        jay@princeton.edu



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:11 CDT