-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello folks!
I created a specialized Linux distriubtion which I am deploying internally.
This distribution boots using InitNG. Most of the systems I supervise mount
at least /home, if not /usr via NFS (v3). The current ifiles distribution is
not suited for this kind of setup, so I edited some of the ifiles. You can
find the modified versions attached to this e-mail, perhaps it is some sort
of template for future versions of either the ifiles or the new initng
scripts.
I'll explain my thoughts and considerations in detail.
1. At boot time, we need to get our network configuration early. Those might
by locally configured (in which case we can read them from somewhere
inside /etc), but this is not likely. So the DHCP client must run with only
the local filesystems mounted. This is basically not a problem, since...
2. /var will never be mounted from NFS, so we can easily store PID files here.
(dhclient acts stupidly; if we do not want it to store its PID to a file, it
will return 0 even if it did not get any IP configuration yet.)
3. When we mount /usr via NFS, all tools we need (dhclient, most important)
will be in /sbin or /bin. What we need is:
- - /bin/mount
- - /sbin/mount.nfs
- - /sbin/dhclient
- - /sbin/portmap
This is sufficient ot mount /usr via NFS.
4. /usr will mostly be read-only, so we do not need NFS locking. rpc.statd
will mostly reside in /usr/sbin - no problem here. /home, however, needs
locking; but until then /usr will be mounted, and rpc.statd available, which
is automatically run from mount.nfs if needed and available. (I, however, did
not yet tweak the mount order, so this *might* be a problem. Further
investigations here are necessary.)
The result is in the attached ifiles. I introduced "nfsmount", which needs
virtual/net and daemon/portmap. "mountfs.i" now comes with mountfs/local,
which tries to mount every local mountpoint. "mount -a" cares for order and
dependencies.
This is not yet perfect, but works for me. Bugs from which I know of are:
1. If more than one NFS mount occurs, /usr is not preferred. So it might be
that /usr is mounted as the last mountpoint, and every NFS share is mounted
without locking.
2. If, for example, /usr is mounted from nfs, but /usr/local locally, this
does not yet work.
I'm doing more investigations on these topics. I thought, however, that the
first working result on the mountfs issue might be of interest for you.
Eric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFG0yGifkUtd7QNU/sRAm7VAJ47H7VYpw/QBVXyeIEJPbumPa6xIACgsSQK
o2YvgrDyCnk+AeSWU6mwNuo=
=DSok
-----END PGP SIGNATURE-----
#!/sbin/itype
# This is a i file, used by initng parsed by install_service
service system/mountfs/local {
need = system/initial system/mountroot system/checkfs;
use = system/sraid system/hdparm system/selinux/relabel;
critical;
script start = {
/bin/mount -a -v -t \
'reiserfs,reiserfs4,ext2,ext3,xfs,jfs,vfat,ntfs,bind'
exit 0
};
script stop = {
echo "Sending all processes the TERM signal..."
/sbin/killalli5 -15
sleep 2
echo "Sending all processes the KILL signal..."
/sbin/killalli5 -9
# This never hurts.
sync
sleep 2
while read dev mp opts
do
case "$mp" in
/|/proc*|/sys|/dev*)
;;
*)
umount -d -r -v -f "$mp"
;;
esac
done < /proc/mounts | /bin/sort -r
sync
};
}
virtual system/mountfs {
need = system/mountfs/local system/mountroot system/checkfs;
use = system/nfsmount;
}
#!/sbin/itype
# NAME: NFS mount script
# WWW: http://nfs-utils.sf.net/
# DESCRIPTION: Mounts NFS shares at boot time (and unmounts them when the
# system is shut down). This script also allows to mount a NFS /usr or /home
# directory.
service system/nfsmount {
need = virtual/net system/mountfs/local daemon/portmap;
script start = {
mount -a -v -t 'nfs,nfsv4'
exit 0
};
script stop = {
sync
umount -a -v -t 'nfs,nfsv4'
exit 0
};
};
# NAME:
# DESCRIPTION:
# WWW:
daemon daemon/dhclient/* {
need = system/mountfs/local system/udev system/clock;
use = system/modules system/coldplug;
exec daemon = /sbin/dhclient -1 -q -pf /var/run/dhcp/dhclient-${NAME}.pid
${NAME};
pid_file = /var/run/dhcp/dhclient-${NAME}.pid;
forks;
respawn;
}
# NAME:
# DESCRIPTION:
# WWW:
daemon daemon/portmap {
need = system/mountfs/local system/udev virtual/net;
forks;
pid_of = portmap;
script daemon = {
touch //var/run/portmap_mapping
chown rpc:root //var/run/portmap_mapping
chmod 660 //var/run/portmap_mapping
exec /sbin/portmap -t //var/empty
};
}
#!/sbin/itype
# NAME: statd
# WWW: http://nfs.sourceforge.net/
# DESCRIPTION: This is part of the nfs-utils package. statd implements the
# Network Status Monitor protocol and notifies the server about locks and
# other status changes.
daemon daemon/statd {
provide = daemon/rpc.statd;
need = virtual/net system/mountfs/local daemon/portmap;
use = service/nfsd system/clock;
stdout = /dev/null;
stderr = /dev/null;
exec daemon = /usr/sbin/rpc.statd -F;
}
--
_______________________________________________
Initng mailing list
[email protected]
http://jw.dyndns.org/mailman/listinfo/initng