SUMMARY: Mounting /usr as a cached filesystem

From: Eamonn.McGonigle@compapp.dcu.ie
Date: Sat Apr 16 1994 - 19:11:46 CDT


As always, the net came through. Curiously, I didn't get a huge number of
replys, and all but one of these recommended not doing this at all. Because
of the small number and because each has its own story to tell, I'll include
the body of all the replys below.

For the impatient, I've added a new file, /etc/rc2.d/S99ycacheusr, containing
the following :-

#! /bin/sh

# Mount a cached filesystem version of /usr over the existing mount

echo "mounting /usr cache filesystem..."
mount -F cachefs -O -o ro,backfstype=nfs,cachedir=/eddie/cache wookie:/usr /usr
echo "done"

...which overlays the original /usr mount (which must be done the honest way
for the purpose of booting, it appears) with a cached version. When I issued
this command the first time, the machine went on a cache-populating rampage and
locked up for quite a while. Once its gets past this, though, everything seems
to be peachy. I can now start openwindows and hardly any traffic flows between
the client and the /usr server (as viewed with etherfind/snoop on a third
machine) apart from a few very small packets (~150 bytes) which I can only
assume are for permission checks etc.

I'll be putting this configuration through its paces over the next couple of
weeks (I've set it up on my own machine for test purposes) and if anybody's
interested I'll send on my impressions of it when I've had time to learn to
hate it (!!!).

Thanks again to all who replied.

Eamonn.

THE REPLIES...
==============
| From: "Jonathan B. Horen" <horen@applicom.co.il>
|
| Re: "setting up all the workstations as dataless" -- I caution you
| against doing so, since it makes them totally dependent on the network.
|
| I suggest another route -- use the automounter to mount /usr/openwin
| and /vol from a central NFS-server. You can do the same thing for
| /usr/man (using catman to format them on the server -- it's a *big*
| time-saver for your users), /usr/games, and /usr/local.
|
----------------------------
| From: paulo@tiete.dcc.unicamp.br (Paulo Licio de Geus)
|
| Why don't you just mount /usr/openwin from another server? About half
| of the 158 MB on my almost full Solaris 2.3 /usr fs is taken by
| openwin. The rest would certainly fit on your 207 Megs...
|
----------------------------
| From: syd@dsinc.myxa.com (Syd Weinstein)
| we do this, but not at boot. You must first mount /usr ro via NFS. This is
| used by the boot. Then you re-mount it via the cache using the remount an
| nfs partition option. This overlays the mount with the cache mount.
|
----------------------------
| From: jamervi@sandia.gov (1236 Joseph A. Mervini)
| I know what you are talking about as far as wasting disk space but you should
| concider a few other things. I recently migrated the majority of my machines
| to solaris and found that it is a disk hog in more ways than one. A small
| root partition doesn't cut it any more. I've set mine up with a 30MB root
| partition and have still run into problems of filling it up. I have also
| got 100MB of swap space.
| This too has been challenged by some of my more compute/memory intensive
| users.
|
| In my humble opinion, I would stick with your original set up and bag the
| idea of setting up a small usr area on a 207 drive. You're only getting
| about 180MB out of it anyway and I think it will probably save you some
| head aches down the road.
----------------------------
| From: steve@cegelecproj.co.uk (Steve_Kilbane)
|
| here's what i got when i asked this question a while back (note that most
| people claimed it wasn't possible):
|
| ----- Begin Included Message -----
|
| >From Ian.Herd%sun-microsystems.co.uk@gec-epl.co.uk Tue Feb 8 11:23 GMT 1994
| Date: Tue, 8 Feb 1994 11:20:36 +0000
| From: Ian.Herd%sun-microsystems.co.uk@gec-epl.co.uk (Ian Herd - Sun UK - Answer Centre)
| To: steve@gec-epl.co.uk
| Subject: Re: CacheFS
|
|
|
| In article <9402071009.AA01561@zombie.gec-epl.co.uk> you write:
| >is there any way of getting a dataless client to cache /usr and /usr/kvm?
| >i spent a remarkably tedious night trying to get the right options in
| >/etc/vfstab, but the machine barfed on the fsck pass, leaving the machine
| >unbootable from its local disk, and needing a boot from CDROM as the only
| >option for modifying /etc/vfstab (yawn...). so far, it looks like the only
| >way is to mount /usr normally, then cache-mount it somewhere else, and just
| >put the cached version into your path - not really what i want.
| >
| >here's the entry i tried last (split for mailers):
| >
| >#device to mount fsck mountp fstype
| >vampire:/export/exec/Solaris_2.3_sparc.all - /usr cachefs
| >
| >#fsck pass mnt@boot options
| >2 no rw,backfstype=nfs,cachedir=/local/cache,cachid=usr
| >
| >...and other attempts including skipping the fsck column (as shown in the
| >Open Issues doc, pg 10), and providing /local/cache as the fsck device.
| >
| >
| >i'll summarise.
| >
| Steve,
| this is unofficial, but this is my workstation
|
| You have to mount usr before cacheing it.
| But then cache it before any processes start.
| As you will see from attached df listing only / /var and /cache
| are normal filesystems, everything else is cached, including
| all the automounter stuff
|
| To do this I have a hacked file in /etc/init.d linked from
| S03MOUNTUSRCACHEFS
|
| Cheers
| IAn
|
| fruitbat 2225 : more S03*
| #
| # readvfstab mount_point
| #
| # Scan vfstab for the mount point specified as $1. Returns the fields of
| # vfstab in the following shell variables:
| # special : block device
| # fsckdev : raw device
| # mountp : mount point (must match $1, if found)
| # fstype : file system type
| # fsckpass : fsck pass number
| # automnt : automount flag (yes or no)
| # mntopts : file system specific mount options.
| # All fields are retuned empty if the mountpoint is not found in vfstab.
| # This function assumes that stdin is already set /etc/vfstab (or other
| # appropriate input stream).
| #
| readvfstab() {
| while read special fsckdev mountp fstype fsckpass automnt mntopts
| do
| case ${special} in
| '#'* | '') # Ignore comments, empty lines
| continue ;;
| '-') # Ignore no-action lines
| continue
| esac
|
| if [ "${mountp}" = "$1" ]
| then
| break
| fi
| done
| }
| case $1 in
| "start")
| cachedir=/cache/system
| if [ -f /BLOW_AWAY_CACHE ]
| then
| echo "clearing caches \c"
| for fs in /var/cache/*
| do
| if [ -f ${fs}/.cfs_label ]
| then
| echo "${fs} \c"
| for cache in `cfsadmin -l ${fs} | tail +9`
| do
| cfsadmin -d ${cache} ${fs}
| done
| fsck -F cachefs ${fs}
| echo "done."
| fi
| done
| rm -f /BLOW_AWAY_CACHE
| fi
| if [ -d ${cachedir} ]
| then
| exec < /etc/vfstab ; readvfstab "/usr"
| if [ ${mountp} -a ${fstype} = "nfs" ]
| then
| echo "Mounting /usr via cachefs\c"
| mount -F cachefs -O -o \
| backfstype=nfs,backpath=/usr,cachedir=${cachedir},non-shared,rw,actimeo=86400 \
| ${special} /usr
| echo " done."
| else
| echo "error reading vfstab, not mounting via cachefs."
| fi
| fi ;;
| "stop")
| : # don't think you can stop this.
| ;;
| esac
|
|
|
| /etc/vfstab:
|
| #device device mount FS fsck mount mount
| #to mount to fsck point type pass at boot options
| #
| #/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
| /proc - /proc proc - no -
| fd - /dev/fd fd - no -
| swap - /tmp tmpfs - yes -
|
| /dev/dsk/c0t3d0s1 - - swap - no -
| /dev/dsk/c0t3d0s6 - - swap - no -
|
| /dev/dsk/c0t1d0s0 /dev/rdsk/c0t1d0s0 /cache ufs 2 yes -
|
| /dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no -
| clem:/usr - /usr nfs - no actimeo=86400
| #clem:/export/exec/kvm/Solaris_2.3_sparc.sun4c/usr/kvm - /usr/kvm nfs - no actimeo=86400
| clem:/export/exec/kvm/Solaris_2.3_sparc.sun4c/usr/kvm - /usr/kvm cachefs - yes backfstype=nfs,cachedir=/cache/system,non-shared,actimeo=86400,ro
| /dev/dsk/c0t3d0s3 /dev/rdsk/c0t3d0s3 /var ufs 4 no -
| clem:/opt - /opt cachefs - yes backfstype=nfs,cachedir=/cache/system,non-shared,actimeo=86400,ro
|
|
|
| df listing
| Filesystem kbytes used avail capacity Mounted on
| /dev/dsk/c0t3d0s0 20503 15632 2821 85% /
| clem:/usr 192063 160024 12839 93% /usr
| clem:/export/exec/kvm/Solaris_2.3_sparc.sun4c/usr/kvm
| 192063 160024 12839 93% /usr/kvm
| /proc 0 0 0 0% /proc
| fd 0 0 0 0% /dev/fd
| /dev/dsk/c0t3d0s3 19213 16608 685 96% /var
| swap 135624 1456 134168 1% /tmp
| /dev/dsk/c0t1d0s0 189858 114237 56641 67% /cache
| /usr 192063 160024 12839 93% /usr
| /cache/system/.cfs_mnt_points/clem:_export_exec_kvm_Solaris_2.3_sparc.sun4c_usr_kvm
| 192063 160024 12839 93% /usr/kvm
| /cache/system/.cfs_mnt_points/clem:_opt
| 281942 50092 203660 20% /opt
| /cache/home/.cfs_mnt_points/hood:_export_home_ianh
| 942663 541805 306598 64% /home/ianh
| /cache/share/.cfs_mnt_points/clem:_export_local
| 489702 209320 231412 47% /share/local
| /cache/share/.cfs_mnt_points/clem:_export_AB
| 1957176 1325349 436117 75% /share/absouth
| /cache/share/.cfs_mnt_points/ukcsd:_home_ukcsd9_patches
| 1178881 1047423 13570 99% /share/patches
| /cache/share/.cfs_mnt_points/ukcsd:_home_ukcsd6_export_dayplanner
| 73352 12491 53526 19% /share/dayplanner
| /cache/direct/.cfs_mnt_points/hot2-dist:_usr_dist
| 3759917 2248975 1134951 66% /usr/dist
|

-------------------------------------------------------------------------------
 Eamonn McGonigle, Phone: (+353 1) 7045649
 School of Computer Applications, FAX: (+353 1) 7045442
 Dublin City University, Mail: eamonn@compapp.dcu.ie
 Dublin 9,
 IRELAND.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:59 CDT