[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: read only nfs root and var



On Sunday 18 January 2009 17:30, Micha Feigin wrote:
> I'm trying to setup a server that export root over a read only nfs file
> system. I managed to enable local settings for each machine by mounting
> it's own disk and then linking some files from etc.
>
> The only problem I'm running into is var which should be partially from the
> head node (looks like most of var/lib) and some local (var/run it seems).
> How do I setup var to play nicely with a readonly root file system (it is
> possible to symlink what needs to be write enabled to the local disk if
> needed)

  I've used unionfs for this -- it's a scheme that lets you mount
a read-only file system and a read-write "overlay", with
copy-on-write semantics, which is to say, when you write a 
file, it creates a new copy of the file on the rw filesystem, 
and uses that in the future.

  It's mainly used for overlaying RAMFS filesystems over
CD-ROMs on various LiveCD distros, but it also works
for rw local disk over ro NFS.  It's fairly straightforward
to mount, and fstab understands it.

  It's provided by a kernel module, but the modules are packaged
for Debian "etch", and I think the functionality is included in 
the kernel source itself for 2.6.24 (etchnhalf) and 2.6.26 (lenny),
but I'm not 100% sure of that -- the machines I do this for
are still vanilla "etch", so as I say, I'm not sure of the 
etchnhalf or lenny status.

  My limited experience (I inherited this configuration from the
previous sysadmin) is that you definitely need to write to 
parts of "var" (/var/run, /var/tmp, and of course /var/log,
but possibly elsewhere), you may need to write to parts of
/etc (the famous /etc/udev/rules.d/z25_persistent-net.rules),
and if you run a graphical desktop, it might want to put
lock-files in /media when it mounts CDs and things.  And there's
/tmp, of course, which however might be a separate filesystem.

  The configuration I'm maintaining uses two unionfs overlays, 
one for /var and one for /etc, a small ramfs for /media, and
a separate filesystem for /tmp.

<http://www.filesystems.org/project-unionfs.html>
<http://packages.debian.org/search?keywords=unionfs&searchon=names&version=all&release=all>
<http://en.wikipedia.org/wiki/UnionFS>

				-- A.
-- 
Andrew Reid / reidac@bellatlantic.net


Reply to: