Date: Mon, 6 Jun 2005 16:39:09 +0930 From: Tim Aslat <tim@spyderweb.com.au> To: freebsd-questions@freebsd.org Subject: Re: Jail and disk space Message-ID: <20050606163909.4b628b63@bofh.spyderweb.com.au> In-Reply-To: <20050605065237.M7642@anonymnet.net> References: <20050605065237.M7642@anonymnet.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 5 Jun 2005 02:00:35 -0500
"DrVince" <drvince@anonymnet.net> wrote:
> Could I use quota to limit jails?
Not really, but you might be able to use a "memory disk" (man md,
mdconfig) to limit the entire jail to a set size.
I haven't tried this myself, but I'm guessing something like this should
work.
#------------------- create jail script -----------------------
#!/bin/sh
ID=${ARGV[1]}
DEST=/jails/jail.${ID}
IMAGE=/jails/images/jail.${ID}
# create a blank disk image of 512 Mb
dd if=/dev/zero of=${IMAGE} bs=1024k count=512
mdconfig -a -t vnode -f ${IMAGE} -u ${ID}
bsdlabel -w md${ID} auto
newfs md${ID}c
mount /dev/md${ID}c ${DEST}
# create jail using created image
cd /usr/src
mkdir -p ${DEST}
make world DESTDIR=${DEST}
cd etc
make distribution DESTDIR=${DEST}
mount_devfs devfs ${DEST}/dev
cd ${DEST}
ln -sf dev/null kernel
#------------------------ End script -----------------------
Again, I haven't tested this, I've just copied & pasted from the
various man pages into a semi-coherent script.
Cheers
Tim
--
Tim Aslat <tim@spyderweb.com.au>
Spyderweb Consulting
http://www.spyderweb.com.au
Phone: +61 8 84193434
Mobile: +61 0401088479
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050606163909.4b628b63>
