Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 08 Mar 2008 12:31:28 -0500
From:      Jeffrey Smith <jeffrey.smith@futurecis.com>
To:        freebsd-jail@freebsd.org
Subject:   ZFS Jails Management
Message-ID:  <1204997488.26124.45.camel@mrwizard.futurecis.com>

next in thread | raw e-mail | index | archive | help
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@YYYYMMDD#
#zfs clone pool/jails/jailbase@YYYYMMDD# pool/jails/ns
#zfs clone pool/jails/jailbase@YYYYMMDD# pool/jails/mail
#zfs clone pool/jails/jailbase@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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1204997488.26124.45.camel>