[CentOS] Problem with RW_MOUNT in a diskless system

Tue Mar 18 00:38:06 UTC 2014
Allan Wu <allwu at cs.ucla.edu>

Hello everyone,

I have a problem with setting up a diskless system on CentOS. Currently I
have successfully set up a small cluster of diskless clients following the
following available HowTos:
http://wiki.centos.org/HowTos/DisklessClients
https://coda.jlab.org/wiki/index.php/CentOS6_Linux_Diskless_Setup

The client system is CentOS 5.10 and the system is read-only. It has been
working fine for a while (although I discard some initiation errors, but as
of functionality it is working). But recently when I tried to setup autofs
to mount some of the directories from NIS server, I've been having problems
because /etc/mtab is not writable. I have enabled temporary state in the
OS, please find below my /etc/sysconfig/readonly-root:
====================
# Set to 'yes' to mount the system filesystems read-only.
READONLY=yes
# Set to 'yes' to mount various temporary state as either tmpfs
# or on the block device labelled RW_LABEL. Implied by READONLY
TEMPORARY_STATE=yes
# Place to put a tmpfs for temporary scratch writable space
RW_MOUNT=/var/lib/stateless/writable
#RW_MOUNT=
# Label on local filesystem which can be used for temporary scratch space
RW_LABEL=stateless-rw
# Options to use for temporary mount
RW_OPTIONS=
# Label for partition with persistent data
STATE_LABEL=stateless-state
# Where to mount to the persistent data
STATE_MOUNT=/var/lib/stateless/state
# Options to use for peristent mount
STATE_OPTIONS=
CLIENTSTATE=10.0.0.1:/common/diskless/x86/RHEL5/snapshot

Now my solution is making a symbolic link for /etc/mtab to its snapshot in
/var/lib/stateless/writable. However, since by default it is mounted on
tmpfs instead of NFS, every time the machine reboot, mtab is lost and there
are all kinds of problem. So I created another mtab.bak and copy that to
the RW_MOUNT when system start. That solves my problem, although I feel the
approach is really ugly.

So my questions are below:
1. How to mount my RW_MOUNT on my NFS snapshot directory by default? The
instructions are not clear on this part.
2. If I can use NFS as snapshot, how do I tell the system which file I want
to use the writable version in RW_MOUNT, is there a more elegant way to do
that?
3. Could someone points me some direction or background on the snapshot
idea? I've looked into /etc/rc.sysinit and saw the part to mount the
stateless directory, but more information could be helpful.

Thank you in advance!

Regards,
--
Di Wu (Allan)
Center of Domain-Specific Computing <http://www.cdsc.ucla.edu/>,
Department of Computer Science, UC Los Angeles
Email: allwu at cs.ucla.edu
Phone: 310-982-5215