Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Dec 1996 19:58:52 +0000 ()
From:      Phil Jensen <phil@qnis.net>
To:        doc@freebsd.org
Subject:   documentation
Message-ID:  <Pine.BSF.3.91.961207195632.2262A-100000@router.qseps.qnis.net>

next in thread | raw e-mail | index | archive | help
Hi,
I'm interested in assisting with the FreeBSD handbook/man documentation 
project.  Attached is a short paper (nroff/me) on FreeBSD quotas, and how 
to implement them.  If you have any extra work, or need some grunt help, 
I'd be glad to assist you.

*snip*

.\" FreeBSD Quotas: an easy install guide.
.\" By Phil Jensen - Network Administrator
.\" QuadraNet Internet Services
.\"
.\" To view, type:
.\" groff -me -Tascii quotas.me
.\"
.ce 1000
.b "FreeBSD Quotas"
.br
.b "Written by Phil Jensen"
.ce 0
.pp
.b FreeBSD
quotas are fairly easy to setup.  Unfortunately, the man pages do not provide
a good place to start, for a first time
.b FreeBSD
user.  The first thing you must do is make sure that support for quotas
are enabled in the kernel.  By default, it isn't.  Please see the section
on kernel compilation if you do not know how to do this.  Essentially, just
add the line:
.(b
options		QUOTA
.)b
to your kernel configuration, and recompile. 
.pp
Secondly, you must enable quotas for the filesystems you wish to monitor.
To do this, edit 
.b /etc/fstab
and add the keywords
.b userquota
or
.b groupquota ,
depending on whether or not you would like to set quotas by group, or user.
If you would like more control over users disk space, select userquota 
instead of groupquota, or, select both.  Place the keyword in field 4,
separated with a comma next to
.b "rw".
Like this:
.(b
/dev/sd0a		/		ufs	rw,userquota 1 1
.)b
After adding the selected flags to the devices, edit your
.b /etc/sysconfig
file and change check_quotas from NO to YES.  At this point, a reboot
will be required in order to build the quota files for each filesystem.
.pp
When you finish rebooting, you may now begin to apply quotas to each user
or group.  You do this with the edquota command.  See also:
.b edquota (8).
A good way to set quotas for multiple users would be to edit a prototype
user and set his/her soft and hard limits, and then to apply that prototype
user's quota to multiple users.  This way, you don't have to manually edit
each user's quota.  For example:
.(b
# edquota phil
# edquota -p phil bob mary jane sue joe wpaul
.)b
This will apply phil's set quota to all of the above users.  You can also
apply prototyped quotas to groups, rather than users.
.pp
Well, I know you must be thinking: I have 3795 users.  How am I going to
set a prototyped user to all of them?  There are multiple ways of doing
this.  Here's a little shell script that I'd use:
.(b
#!/bin/sh

users=$(ls /usr/home)
repquota -p phil $users
.)b
This may croak if your argument line is too long, you can also try:
.(b
#!/bin/sh

users=$(ls /usr/home)
for u in $users; do
  repquota -p phil $u
  echo "Set quota for $u."
done
.)b
This will take a lot more time, as it execs repquota for every user, but does
not overflow the argument vector.
.pp
If you have any questions or comments on this document, please email:
.b phil@qnis.net .

Phil Jensen				QuadraNet Internet Services
Network Administrator / Manager		http://www.qnis.net
UNIX -is- user-friendly!  Its just picky about who its friends are.
Check out my Bourne Shell Tips Page!  http://www.qnis.net/~phil/faq.html




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.961207195632.2262A-100000>