From owner-freebsd-questions@FreeBSD.ORG Sun Jun 29 20:31:18 2003 Return-Path: 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 15B2F37B401 for ; Sun, 29 Jun 2003 20:31:18 -0700 (PDT) Received: from ren.sasknow.com (ren.sasknow.com [207.195.92.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2285F44025 for ; Sun, 29 Jun 2003 20:31:17 -0700 (PDT) (envelope-from ryan@sasknow.com) Received: from ren (ren [207.195.92.131]) by ren.sasknow.com (8.12.6p2/8.12.6) with ESMTP id h5U3VFDO017276; Sun, 29 Jun 2003 21:31:16 -0600 (CST) (envelope-from ryan@sasknow.com) Date: Sun, 29 Jun 2003 21:31:15 -0600 (CST) From: Ryan Thompson To: Josh Brooks In-Reply-To: <20030629180934.O57224-100000@mail.econolodgetulsa.com> Message-ID: <20030629210853.T86432-100000@ren.sasknow.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: questions@freebsd.org Subject: Re: question regarding quotas X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2003 03:31:18 -0000 Josh Brooks wrote to Lowell Gilbert: > Again, I am just trying to take an arbitrary directory, say: > > /export/data7/homes/jerry > > and place a configurable limit on how big that directory can get, > without mounting it as its own filesystem... FreeBSD doesn't support any filesystems that do this proactively. From an OS point of view, it doesn't really make sense. However, I can see a few scenarios where this would be helpful, and it is more than possible to enforce directory size limits reactively. For example: #!/bin/sh if [ $# -ne 1 ]; then echo "usage: $0 pathname" 1>&2 exit 2 fi QUOTA="102400"; # Max. usage, kilobytes SIZE=`du -xd 0 $1 | cut -f 1` echo "Directory size is $SIZE" if [ $SIZE -gt $QUOTA ]; then echo "$1 is over quota"; # Take appropriate action, here... else echo "$1 is OK"; fi That's an illustrative example; it'll be easy to extend that to loop over an arbitrary list of users (or all system users). You can then run it periodically from cron(8) to check disk usage at the interval of your choosing, and react accordingly. As others have mentioned, users may find other directories and filesystems to store files, thereby circumventing your quota check. So, it's up to you to harden your system to mitigate that. Also, as this is a reactive approach, your users still have the ability to fill up your disk, but at least you can react appropriately (and possibly automatically). Though, I think I've at least answered your question. :-) Hope this helps, - Ryan -- Ryan Thompson SaskNow Technologies - http://www.sasknow.com 901-1st Avenue North - Saskatoon, SK - S7K 1Y4 Tel: 306-664-3600 Fax: 306-244-7037 Saskatoon Toll-Free: 877-727-5669 (877-SASKNOW) North America