From owner-freebsd-questions@FreeBSD.ORG Mon Jun 6 15:45:48 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E2B3816A41C for ; Mon, 6 Jun 2005 15:45:48 +0000 (GMT) (envelope-from chad@shire.net) Received: from hobbiton.shire.net (hobbiton.shire.net [166.70.252.250]) by mx1.FreeBSD.org (Postfix) with ESMTP id A1EFC43D55 for ; Mon, 6 Jun 2005 15:45:48 +0000 (GMT) (envelope-from chad@shire.net) Received: from [67.161.222.227] (helo=[192.168.99.68]) by hobbiton.shire.net with esmtpa (Exim 4.51) id 1DfJnO-0003rc-HV; Mon, 06 Jun 2005 09:45:47 -0600 In-Reply-To: <20050606163909.4b628b63@bofh.spyderweb.com.au> References: <20050605065237.M7642@anonymnet.net> <20050606163909.4b628b63@bofh.spyderweb.com.au> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: "Chad Leigh -- Shire.Net LLC" Date: Mon, 6 Jun 2005 09:45:45 -0600 To: Tim Aslat X-Mailer: Apple Mail (2.730) X-SA-Exim-Connect-IP: 67.161.222.227 X-SA-Exim-Mail-From: chad@shire.net X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on hobbiton.shire.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50 autolearn=disabled version=3.0.3 X-SA-Exim-Version: 4.2 (built Mon May 30 00:43:02 MDT 2005) X-SA-Exim-Scanned: Yes (on hobbiton.shire.net) Cc: freebsd-questions@freebsd.org Subject: Re: Jail and disk space X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jun 2005 15:45:49 -0000 On Jun 6, 2005, at 1:09 AM, Tim Aslat wrote: > On Sun, 5 Jun 2005 02:00:35 -0500 > "DrVince" 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. Yes, I do this. Almost all my jails reside in md devices (or more than one if I have separate ones for logs etc). Dump works on md devices so it makes it pretty easy. Since I use a shared master jail mounted readony inside each jail, the jail md devices only have the jail specific files in them and the jail users data. /bin /sbin /lib /usr/bin etc are all shared readonly. Appropriate links into the md device for /usr/local . / etc and /var are in the md device. Chad > > 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 > Spyderweb Consulting > http://www.spyderweb.com.au > Phone: +61 8 84193434 > Mobile: +61 0401088479 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions- > unsubscribe@freebsd.org" > --- Chad Leigh -- Shire.Net LLC Your Web App and Email hosting provider chad@shire.net