Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Nov 2009 17:42:30 -0700
From:      David Allen <the.real.david.allen@gmail.com>
To:        Chuck Swiger <cswiger@mac.com>
Cc:        freebsd-questions@freebsd.org, James Phillips <anti_spam256@yahoo.ca>
Subject:   Re: APM
Message-ID:  <2daa8b4e0911131642p4d5935d1vff9cac77a43610ea@mail.gmail.com>
In-Reply-To: <D2C5A981-0ED8-4280-929B-EAC85D5D1D7A@mac.com>
References:  <474730.92984.qm@web65506.mail.ac4.yahoo.com> <E7630082-8284-45A3-AF72-7C3DB2BBB9DA@mac.com> <2daa8b4e0911131448h3444444ag67ad05bbbf7df60@mail.gmail.com> <07E2B7F8-3B7B-4B1C-AE6E-B5219BEDE769@mac.com> <2daa8b4e0911131554g1e13bdbbh123f52fb2572d5a0@mail.gmail.com> <D2C5A981-0ED8-4280-929B-EAC85D5D1D7A@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/13/09, Chuck Swiger <cswiger@mac.com> wrote:
> Hi--
>
> On Nov 13, 2009, at 3:54 PM, David Allen wrote:
>>> I'd consider adding something to /etc/rc.d/mountcritlocal (which
>>> normally mounts the local filesystems) to setup a RAMdisk on /var and
>>> then do "rsync -a /var_template /var" (or use a dump/restore or tar
>>> pipeline).
>>
>> At the risk of sounding obtuse while asking for more help, I can work
>> out the rsync or dump part, but the rest I don't  get. The
>> mountcritremote essentially just does a mount -a -t ..., yes?  To
>> insert a few mdmfs commands followed by rsync commands, for example,
>> would require re-writing most the script.  Is there  a better place to
>> this?
>
> Quite possibly.  I used NetBSD for a flash-based Soerkris boxes a
> while back, rather than NanoBSD.  It looks like reading /etc/
> rc.initdiskless might be informative.
>
>> The reason I ask is that some time ago I had a look at nanobsd which
>> is designed to run on RO flash media.  The /var and /tmp directories
>> are created as memory devices that supposedly get re-populated from a
>> /cfg directory at boot.
>
> Right...
>
>> The /usr/src/tools/tools/nanobsd/nanobsd.sh setup script has a
>> function named setup_nanobsd_etc.  Essentially, it writes out an
>> /etc/fstab file and does a 'touch /etc/diskless'.  Unless there's
>> magic that happens behind the scenes with that /etc/diskless file, I
>> don't see how anything gets re-populated.
>
> The existence of /etc/diskless means /etc/rc runs /etc/rc.initdiskless:

Aaaargh!  For those following along at home, that's

  /etc/rc.initdiskless

and not

  /etc/rc.d/somethingdiskless

> % grep diskless /etc/rc
> dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
> if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then
> 	sh /etc/rc.initdiskless
> # Run these after determining whether we are booting diskless in order
> # to minimize the number of files that are needed on a diskless system,

The answer finally appears!

A note to the OP.  The only way I've found to keep a disk spun down
under FreeBSD is using memory devices for both /var and /tmp.
Disabling syslogd isn't enough, nor is modifying /etc/crontab, root's
crontab (or even disabling cron) to limit disk access.  But to use
memory devices and have a "normal" system, you'll need to re-populate
both /var and /tmp at startup.   Which, it turns out, means starting
with /etc/diskless.

Someone should add a section named  "Non-Diskless Diskless Operation"
to the Handbook.

Thanks again for all the help!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2daa8b4e0911131642p4d5935d1vff9cac77a43610ea>