Date: Sun, 27 Aug 2000 17:04:44 +0200 From: Adrian Steinmann <ast@marabu.ch> To: Alan Clegg <abc@firehouse.net>, Greg Lehey <grog@lemis.com>, Warner Losh <imp@village.org> Cc: freebsd-questions <freebsd-questions@FreeBSD.ORG>, freebsd-small@FreeBSD.ORG Subject: Re: read only / filesystem Message-ID: <200008271504.RAA12041@marabu.marabu.ch> In-Reply-To: <20000826014750.F32393@diskfarm.firehouse.net> References: <20000824002732.A45983@dogma.freebsd-uk.eu.org> <20000824101341.D66923@wantadilla.lemis.com> <20000824130404.A51338@dogma.freebsd-uk.eu.org> <20000825111535.F548@wantadilla.lemis.com> <20000824234917.A93373@mammalia.org> <20000826110117.F52219@wantadilla.lemis.com> <20000826014750.F32393@diskfarm.firehouse.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Greg Lehey said: > Basically, I think our current layout isn't really suited to a > read-only root file system. Somebody should think out a better > approach (and wonder whether the change is worth the effort). Actually, if your not doing net-booting you can misappropriate those hooks to do it surprisingly non-intrusively! I'm using my /etc/rc.readonly script attached below which is invoked by adding/setting these entries in /etc/rc.conf: rootdev=fla0 root_rw_mount=NO diskless_mount=/etc/rc.readonly etc_size=1536 home_size=1024 var_size=32768 sio='cuaa1' ===== start of /etc/rc.readonly ===== # @(#) $Id: rc.readonly,v 1.63 2000/08/20 10:26:02 root Exp $ if [ -f /etc/defaults/rc.conf ]; then . /etc/defaults/rc.conf elif [ -f /etc/rc.conf ]; then . /etc/rc.conf fi echo -n "Making writable mfs filesystems:" mount_mfs -s ${var_size:=65536} -T qp120at dummy /var while [ -e /var/.readonly ]; do sleep 1; done for d in root log run db msgs cron cron/tabs spool spool/mqueue spool/lock \ tmp tmp/vi.recover at at/jobs at/spool do mkdir /var/$d && chmod 755 /var/$d done chmod 755 /var chmod 1777 /var/tmp /var/tmp/vi.recover chown daemon /var/at/jobs /var/at/spool touch /var/run/utmp && chmod 644 /var/run/utmp touch /var/log/wtmp && chmod 664 /var/log/wtmp chown uucp:dialer /var/spool/lock chmod 775 /var/spool/lock { cd /root && tar cBf - . | { cd /var/root && tar xBf -; }; } echo -n " var" cp /dev/MAKEDEV /var/tmp mount_mfs -s 256 -i 512 -T qp120at dummy /dev while [ -f /dev/.readonly ]; do sleep 1; done cp /var/tmp/MAKEDEV /dev && rm -f /var/tmp/MAKEDEV for d in std ${rootdev} ${rootdev}s1h vty12 pty0 ttyd0 ttyd1 cuaa1 $sio do { cd /dev && sh MAKEDEV $d; } done echo -n " dev" for d in etc home do { cd /$d && tar cBf - .; } > /var/tmp/$d.tar eval mount_mfs -s \${${d}_size:=1024} -T qp120at dummy /$d while [ -e /$d/.readonly ]; do sleep 1; done { cd /$d && tar xBf /var/tmp/$d.tar; } rm -f /var/tmp/$d.tar && echo -n " $d" done echo ===== end of /etc/rc.readonly ===== _________________________________________________________________________ Dr. Adrian Steinmann Steinmann Consulting Apollostrasse 21 8032 Zurich Tel +41 1 380 30 83 Fax +41 1 380 30 85 Mailto:ast@marabu.ch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008271504.RAA12041>