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:


if [ $# -ne 1 ]; then
    echo "usage: $0 pathname" 1>&2
    exit 2

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...
    echo "$1 is OK";

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

  SaskNow Technologies -
  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

[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to