Re: Jail and disk space

2005-06-06 Thread Chad Leigh -- Shire.Net LLC


On Jun 6, 2005, at 1:09 AM, Tim Aslat wrote:


On Sun, 5 Jun 2005 02:00:35 -0500
"DrVince" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
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- 
[EMAIL PROTECTED]"




---
Chad Leigh -- Shire.Net LLC
Your Web App and Email hosting provider
[EMAIL PROTECTED]


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Jail and disk space

2005-06-06 Thread Björn König

Tim Aslat wrote:


"DrVince" <[EMAIL PROTECTED]> 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.


This sounds like a great idea. It would make backups and moving resp. 
copying jails much easier.


Thanks for this thought. I'll try it today.

Björn
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Jail and disk space

2005-06-06 Thread Tim Aslat
On Sun, 5 Jun 2005 02:00:35 -0500
"DrVince" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
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 "[EMAIL PROTECTED]"


Re: Jail and disk space

2005-06-05 Thread Björn König

DrVince wrote:


Could I use quota to limit jails?


You can add each user of a jail to a specific jail group and use group 
quotas at the host environment. These words as shell commands:


insidethejail# pw addgroup jail01 -g 8001 -M `grep -v '^#' 
/etc/master.passwd | cut -d: -f1 | tr '\n' ','`


outsidethejail# pw addgroup jail01 -g 8001 && edquota -g jail01

This is obviously not a safe limitation as long as the root user of a 
jail is able to remove users from this group.


Björn
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Jail and disk space

2005-06-05 Thread DrVince
Hi everyone,

Could I use quota to limit jails?

Thanks,
DrVince

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"