From: mbarkah@slate.mines.colorado.edu (Ade Barkah)
Newsgroups: comp.unix.admin
Subject: Re: Disk quotas
Date: 8 Jan 93 13:11:22 GMT
Organization: Colorado School of Mines

In article <1993Jan7.100012.11101@ugle.unit.no>:
: The edquota starts VI and then You should write in the quotas.
: 
: You get a line like this:
: fs /home blocks ( soft=0, hard=0 ) inodes ( soft=0, hard=0 )
: 
: What does it mean with soft and hard, - and what relation am I to use 
: between blocks and inodes ?

The 'soft' limit is a `warning' limit. That is, the user may use
more than the soft limit, but only temporarily. When a user
violates this soft limit, a timer is started. If the user then
reduces his/her dataspace within a certain time (usually a week,)
then nothing happens. If the user still violates the soft limit
after the week, then any attempt to create more data will fail.
The user then needs to reduce his/her dataspace below the
soft limit.

The 'hard' limit is the 'real' limit. At no time can the user
have more than the hard limit.

For example, I might set up quota for user 'joe' as having a
soft limit of 5000 blocks, and a hard limit of 8000 blocks.
If `joe' currently has 4900 blocks, he can create up to 3100
(up to the hard limit) blocks of dataspace. However, if after
one week, 'joe' hasn't reduced his dataspace to below 5000,
any attempt to use more space will fail.

In other words, 'joe' can create more than the soft limit for
a week, but he can never have more than the hard limit.

Actually, the amount of time a user may violate the soft
limit can be changed with edquota -t.

As with data blocks, the number of inodes a user can consume
can also be rationed. Inodes quota also follow the "soft" and
"hard" limit convention. Systems may run into problems when
a large number of users have an abnormally large number of
small files, since each files consume inodes. However, this
situation is probably rare, and simply using the default
values might be enough. If you have to set up inode quotas,
then you need to find out the total number of inodes your
filesystem can handle, subtract the number of inodes used
by the system, then divide by the maximum number of users
you may have. Personally, I don't bother. :)

To use the default values (both for the soft and hard, block
and inode quotas) simply use '0' as limit (eg. soft=0.) 
Consult your documentation to find out what are the default
values. On my svr4 system it is defined in the /usr/include/
sys/fs/ufs_quota.h or something similar.

It might be easier to make one 'template' user, say, your
own account, with the appropriate quotas. Then you can
`copy' or `pass-on' these quotas to other users using
the -p option, which duplicates the quota for the `template'
(proto) user to another user.

For example, use `edquota -t' to set the soft-limit time
expiration. Then use `edquota my_login' to change your
own quota. Then use 'edquota -p my_login user_login'
to change user_login's quota to match yours.

I put `edquota -p my_login new_login' in a program which
accepts new accounts. That way, all new accounts gets
the quota. To set up quotas for existing accounts, run
`edquota -p' in a shell script.

Before turning on quota on a filesystem, it is advisable
to run `quotacheck.' quotacheck updates the quota file
to reflect the current disk space. Also double check
your documentation, since your version of Unix may work
slightly differently, and more importantly, I may have
forgotten something.... <smile>

Finally, since soft-limit violation are not automatically
announced to users, you may want to encourage them to
put the `quota -v' command (the -v checks all filesystems 
with quotas) in their startup file (.login/.profile.)

Regards,

-Ade
-- 
Internet  : mbarkah@slate.mines.colorado.edu    (NeXT Mailable)
CompuServe: 74160,3404
Newsgroups: comp.unix.admin,comp.sys.sun.admin