Save 90% of diskspace on your FreeBSD jails by using a shared /usr.

You can save 90% of the disk-usage (aprx. 16MB only instead of 180MB) of a plain jail by sharing the /usr from the jail-host:

cd /opt/jails/192.168.0.100; rm -rf /usr; mkdir usr
mount -t null -o ro /usr /opt/jails/192.168.0.100/usr

and you need to change the /etc/rc.conf of the jail(s) with shared /usr slightly:

local_startup=”“

So the jails do not search startup in the /usr/local/etc/rc.d (of the jail-host).

jail_install takes the argument -light which does all the steps described above, then jail_start and jail_stop mount and umount /usr for you.

Important Note: The jail_root (defined in /usr/local/etc/jail.conf) must lie outside /usr (not /usr/jails) but /opt or something else, otherwise mount -t null won’t work as distinct paths (paths which are not part of each other) required.

I created a dedicated slice (/opt/) on my jail-host which only hosts the jails:

/dev/ad0s1a on / (ufs, local) /dev/ad0s1e on /var (ufs, local, soft-updates) /dev/ad0s1f on /tmp (ufs, local, soft-updates) /dev/ad0s1g on /usr (ufs, local, soft-updates) /dev/ad0s1h on /opt (ufs, NFS exported, local, soft-updates)

Posted by Administrator on Sunday, October 22, 2006

digg delicious technorati blinklist furl reddit