Re: HEADSUP: Filesystem rototiling over

From: Jeremie Le Hen <jeremie_at_le-hen.org>
Date: Tue, 2 Nov 2004 14:04:12 +0100
> Web-Service(s), Mail-Service(s), Name-Service, ...
> 
> And on each update I had to stop the services, shutting down the jail,
> unmount each ro-bunch, mount rw, update, unmount, remount ro-bunches,
> starting jails & services.

I had a very small patch [1] that could be useful for this purpose.  I
use nullfs for my jails and I was fed up with the process you described
(the reasons are explained in the email I first sent about this, see URL
below [2]).

The basic idea of this patch is to add a new flag to mount(8)/umount(8)
in order to be able to select filesystems to work on using a prefix.  We
can then ask rc.d/jail to mount (resp. umount) jail related filesystems
while starting (resp. stopping) a jail.

For example, here is the relevant part of my fstab(5):
    /lib                    /jail/named/lib         nullfs  ro      0       0
    /libexec                /jail/named/libexec     nullfs  ro      0       0
    /usr/sbin               /jail/named/usr/sbin    nullfs  ro      0       0
    /etc/namedb             /jail/named/etc/namedb  nullfs  ro      0       0
    /var/run/named          /jail/named/var/run/named nullfs rw     0       0
    
    /bin                    /jail/postfix/bin       nullfs  ro      0       0
    /lib                    /jail/postfix/lib       nullfs  ro      0       0
    /libexec                /jail/postfix/libexec   nullfs  ro      0       0
    /etc/mail               /jail/postfix/etc/mail  nullfs  ro      0       0
    /usr/bin                /jail/postfix/usr/bin   nullfs  ro      0       0
    /usr/lib                /jail/postfix/usr/lib   nullfs  ro      0       0
    /usr/local/lib          /jail/postfix/usr/local/lib nullfs ro   0       0
    /usr/local/libexec/postfix /jail/postfix/usr/local/libexec/postfix nullfs ro 0 0
    /usr/local/sbin         /jail/postfix/usr/local/sbin nullfs ro  0       0
    /usr/local/etc/postfix  /jail/postfix/usr/local/etc/postfix nullfs ro 0 0
    /var/mail               /jail/postfix/var/mail  nullfs  rw      0       0
    /var/spool/postfix      /jail/postfix/var/spool/postfix nullfs rw 0     0
    
    
And the relevant rc.conf(5) variables:
    jail_enable="YES"
    jail_list="named postfix"
    
    jail_named_rootdir="/jail/named"
    jail_named_hostname="box1.domain.com"
    jail_named_ip="192.168.1.53"
    jail_named_exec="/usr/sbin/named -u bind"
    jail_named_devfs_enable="YES"
    jail_named_fdescfs_enable="YES"
    jail_named_procfs_enable="YES"
    jail_named_devfs_ruleset="devfsrules_named"
    jail_named_mount_enable="YES"		<------- here
    
    jail_postfix_rootdir="/jail/postfix"
    jail_postfix_hostname="box2.domain.com"
    jail_postfix_ip="192.168.1.25"
    jail_postfix_exec="/usr/local/sbin/postfix start"
    jail_postfix_devfs_enable="YES"
    jail_postfix_fdescfs_enable="YES"
    jail_postfix_procfs_enable="YES"
    jail_postfix_devfs_ruleset="devfsrules_postfix"
    jail_postfix_mount_enable="YES"		<------- and here
    

Now I can simply make
    /etc/rc.d/jail stop
before installworld and then restart jails with the opposite command, and
filesystems will get mounted and umounted automagically.

[1] http://jeremie.le-hen.org/~tataz/patches/FreeBSD/mount-c+jail_mount.patch
[2] http://lists.freebsd.org/pipermail/freebsd-current/2004-July/032004.html

-- 
Jeremie Le Hen
jeremie_at_le-hen.org
Received on Tue Nov 02 2004 - 12:04:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:20 UTC