Date: Fri, 13 Jan 1995 10:57:27 -0600 (CST) From: Joe Greco <jgreco@brasil.moneng.mei.com> To: martin@innovus.com (Martin Renters) Cc: luigi@labinfo.iet.unipi.it, hackers@FreeBSD.org Subject: Re: About readonly root partition Message-ID: <9501131657.AA02484@brasil.moneng.mei.com> In-Reply-To: <199501131534.HAA11820@freefall.cdrom.com> from "Martin Renters" at Jan 13, 95 10:38:02 am
next in thread | previous in thread | raw e-mail | index | archive | help
> > So, How about letting "init" look for "/rc" instead/before
> > looking for /etc/rc ? This would help in having the following:
> >
> > 1) a main "rc" is called, which does the initial checks;
> > 2) mounts the proper filesystem onto /etc;
> > 3) passes control to /etc/rc
> >
> > With the current setting, the above might still work except that, once
> > the new /etc is mounted, the original /etc/rc is no more readable.
>
> /etc, /tmp, and /var all need to be separate for each diskless client.
>
> I do agree that it would be a good idea to do something to allow selective
> mounting at system startup time. Perhaps init could tell that it is running
> diskless and run some sort of shared '/etc/diskless.rc' script which could
> mount the correct /etc, /tmp and /var filesystems based on some system
> administrator defined scheme.
>
> An example /etc/diskless.rc might contain:
>
> mount server:/exports/etc/$hostname /etc
> mount server:/exports/tmp/$hostname /tmp
> mount server:/exports/var/$hostname /var
>
> And then execute /etc/rc (which would now be the system specific one)
Perhaps define a search path for "rc" in init? "/sbin/rc:/etc/rc" and by
default do not provide an /sbin/rc. If one exists, in this case, it could
be something like
mount server:/exports/etc/$hostname /etc
. /etc/rc
I hacked around this by making my root NFS partition writable (bypassing all
these problems). I have always hacked around similar problems in the past,
as well. Typically I mount / rw, and /usr ro, which means that I have to
have a per-system /, but I have a little script that hardlinks share-able
files rather than copying them, so that in essence /etc, /var, and /tmp are
unique on each box, but /bin's binaries are shared. My little wonder-script
to do this is appended at the end. Tailored for our local environment,
alas. It's cheesy, it's quick, it's dirty. No apologies. :-) brasil is
my SunOS 4.1.3 workstation with lotsa disk. I'm always shopping for a
better solution, though...
People are arguing things about DISKLESS being undesirable and the
like, but in reality I find that it is very effective to be able to
walk up to an arbitrary PC here at work, cram a disk in, and be running
UNIX and X a few minutes later. Very impressive demonstration of a
technically superior operating system. ;-)
... Joe
-------------------------------------------------------------------------------
Joe Greco - The Data Capture Fellow (and UNIX/Network Hacker) 414/362-3617
Marquette Electronics, Inc. - Milwaukee, WI jgreco@brasil.moneng.mei.com
% cat /nfs/2.0S/root/dup
#! /bin/sh -
master=master
dup=$1
mkdir ${dup}
(cd $master; find * -print) | (
while read i; do
if [ -h ${master}/$i ]; then
echo symlink `ls -l ${master}/$i | awk '{print $10}'` ${dup}/$i
ln -s `ls -l ${master}/$i | awk '{print $10}'` ${dup}/$i
continue;
fi
if [ -f ${master}/$i ]; then
case "$i" in
etc/*|var/*)
echo copy ${master}/$i ${dup}/$i
cp -p ${master}/$i ${dup}/$i;;
*)
echo link ${master}/$i ${dup}/$i
ln ${master}/$i ${dup}/$i
esac
continue;
fi
if [ -d ${master}/$i ]; then
echo mkdir ${dup}/$i
mkdir ${dup}/$i
chown -f `ls -ldg ${master}/$i | awk '{print $3 "." $4}'` ${dup}/$i
continue;
fi
if [ -c ${master}/$i ]; then
continue;
fi
if [ -b ${master}/$i ]; then
continue;
fi
if [ -p ${master}/$i ]; then
continue;
fi
done
)
chmod 1777 ${dup}/tmp ${dup}/var/tmp
echo ${dup} > ${dup}/etc/myname
chmod 644 ${dup}/etc/myname
echo ${dup} > ${dup}/etc/hostname.ed0
chmod 644 ${dup}/etc/hostname.ed0
echo "151.186.20.4 brasil" >> ${dup}/etc/hosts
echo "151.186.20.x ${dup}" >> ${dup}/etc/hosts
vi + ${dup}/etc/hosts
(
echo "brasil:/nfs/2.0S/root/${dup} / nfs rw 0 0"
echo "brasil:/nfs/2.0S/usr /usr nfs ro 0 0"
echo "brasil:/nfs/2.0S/usrsrc /usr/src nfs ro 0 0"
echo "brasil:/nfs/2.0S/local /usr/local nfs ro 0 0"
echo "brasil:/nfs/2.0S/X11R6 /usr/X11R6 nfs ro 0 0"
) > ${dup}/etc/fstab
chmod 644 ${dup}/etc/fstab
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9501131657.AA02484>
