ZFS Jails Management

Jeffrey Smith jeffrey.smith at futurecis.com
Sat Mar 8 17:58:08 UTC 2008


I created a little cheat sheet for ZFS Jails (don't know if already
exists, can't find it by google).  This works but was wondering if there
was a better way, or ways to improve this.

                               ZFS Jails


#zpool create pool
#zfs create -o mountpoint=jails pool/jails
#zfs create pool/jails/jailbase
#mkdir -p /jails/7.0-RELEASE/base /jails/7.0-RELEASE/manpages
#cd /jails/7.0-RELEASE/base

NOTE: Files can also be copied from Disc1 cdrom

#ftp ftp.freebsd.org:/pub/FreeBSD/releases/amd64/7.0-RELEASE/base/

ftp>mget *
ftp>cd ../manpages
ftp>lcd ../manpages
ftp>mget *
ftp>exit

#export DESTDIR=/jails/jailbase
#sh install.sh
#cd ../manpages
#sh install.sh
#export DESTDIR=””
#mkdir -p /jails/jailbase/usr/ports
#mount_nullfs /usr/ports /jails/jailbase/usr/ports
#touch /jails/jailbase/etc/fstab
#cp /etc/resolv.conf /jails/jailbase/etc
#vi /etc/rc.conf

#
# Jail Defaults
#
jail_enable=”YES”
jail_set_hostname_allow=”NO”
jail_interface=”bge0”
jail_devfs_enable=”YES”
jail_list=”jailbase”

#
# jailbase.example.org
#
jail_jailbase_hostname=”jailbase.example.org”
jail_jailbase_ip=”192.168.0.50”
jail_jailbase_rootdir=”/jails/jailbase”

:wq

#/etc/rc.d/jail start
#jls
#jexec 1 tcsh

#set autolist

NOTE: freebsd-update appears to work, but no updates are yet available
for 7.0 to test this further
Install ports or packages that all jails will require, such as bash and
vim-lite

#exit

Back to host

#zfs snapshot pool/jails/jailbase at YYYYMMDD#
#zfs clone pool/jails/jailbase at YYYYMMDD# pool/jails/ns
#zfs clone pool/jails/jailbase at YYYYMMDD# pool/jails/mail
#zfs clone pool/jails/jailbase at YYYYMMDD# pool/jails/www
#vi /etc/rc.conf

...snip...
jail_list=”jailroot ns mail www”
...snip...

#
# ns.example.org
#
jail_ns_hostname=”ns.example.org”
jail_ns_ip=”192.168.0.51”
jail_ns_rootdir=”/jails/ns”

#
# mail.example.org
#
jail_mail_hostname=”mail.example.org”
jail_mail_ip=”192.168.0.52”
jail_ns_rootdir=”/jails/mail”

#
# www.example.org
#
jail_www_hostname=”www.example.org”
jail_www_ip=”192.168.0.53”
jail_www_rootdir=”/jails/www”

:wq

#/etc/rc.d/jail start
#jls



More information about the freebsd-jail mailing list