Installing quotas in the kernel
===============================

The diffs found in the package are context diffs against plain 1.1.16 code.
Ok do the following steps.

First create an copy off the old stuff, just in case.
1) cd /usr/src
2) tar czvhf oldlinux.tar.gz linux 

Ok now start unpacking the stuff
3) cd /usr/src/linux
4) patch -p1 < <where_ever_you_put_it>/kdiffs_1.1.16

Check for rejections and if there are try something to do about it.
5) find . -name \*.rej

Ok when you have done this, we can get ride of the orig files.
6) find . -name \*.orig | xargs rm

Ok now configure your kernel
7) cd ..
8) make config
Say yes to the Disk QUOTA support.

Do a make depend and rebuild the kernel.
9) make depend
10) make

Now you should have a new kernel Image, install that as usual.

Ok now build the utils and install them.
Copy the mntent.h file found in this directory to /usr/include to replace the
original one that is kind of small and is lacking all kinds op options.

Last but least fill out REGISTRATION and send that by email back to me. This
gives me info about how many people use it and make some things easier for me.
People that already send me there registration don't have to do it again I saved
those for later.

[ TO USE THE PROCESSACCOUNTING DIFFS IN THIS PACKAGE YOU NEED THE GNU ACCOUNTING
  UTILS THAT CAN BE FOUND ON PREP.AI.MIT.EDU ]

Enabling quotas on a filesystem
===============================

To enable quotas on a certain filesystem one should edit the /etc/fstab
file and add entries for usrquota and grpquota. Mine looks like :

# device		directory	type	options				
/dev/hda1		/		ext2	defaults			
/dev/hda2		none		swap	sw
/dev/hda3 		/usr		ext2	defaults
/dev/hdb1 		/usr/users	ext2	defaults,usrquota,grpquota	
/dev/hdb2 		/usr/src	ext2	defaults,usrquota		
none			/proc		proc	defaults			

The keyword "usrquota" in the options field of each fstab-entry turns on
userquota for this device. The keyword "grpquota" in the options field turns
on groupquota for the device. When you use the usrquota and grpquota options
without the "=" option you quotafiles are located in the rootdir of each 
filesystem. A file called "quota.user" is used for userquota and a file called
"quota.group" is used for groupquota.

From version 1.1 you are also able to define your quotafile yourself there.
Something like "usrquota=/usr/adm/quotasrc.user". Please be aware of the
maximum lenght a line can have in your fstab, see mntent.h for a definition.
When you really want to use this option you should link the programs with the
mntent.c supplied with this package because the library has some problems with
parsing a fstab file.

Turning quotas on
=================

When this is the first time you install quota run "quotacheck -avug" to
install all the quotafiles in the root dirs of your filesystems. Or when
you defined it with the [usr|grp]quota="" lines in your fstab in the place
you mention there. Don't use the -d flag of the quotacheck program when
checking a device because that is used for debugging purposes only and it
makes the scan very slowly.

The quotacheck program takes some time on large filesystems, but whith the
new version it is quite acceptable on my machine. But when you are hacking
the kernel, I recommend not to use it because it takes some time every time
you have to reboot your machine. You also can also put it in you rc script
and run it like you run fsck on your filesystems only when the fastreboot
flag is not set. There is no support for parallel checking of filesystems,
but maybe that will come in a next release. Please feel free to try
implement it. If nobody does it I have to do it myself but then it will
take some time because it is for now not very high on my wish list. And it
isn't probably to fast on an IDE disk to do simultaniously.

Ok now one should have all the quotafiles one needs.
Now you can add a line like:

/usr/etc/quotaon -avug (Or without the -v flag if you don't wanna see
                        what quota is being turned on).

to your /etc/rc. This is to turn the quotas on when you boot your machine.
This is they way to go and not turn it on yourself any time when you boot
your machine.

Checking a filesystem for quotas
================================

Just run "quotacheck -avug" and the quotafiles are updated automagicaly and
also the tables that are currently used by the kernel. Watch for the 
"updating in core quotas" message of the quotacheck program this says if it
updates the in core quotas in the kernel. I cannot state this enough the
quotafile is build as (uid || gid * sizeof(struct dquot)) so when you have
nonbody as uid 65535 and nobody owns a file you get big quota files, lets
say of about 2 Mb all filed with zero's for users that don't have quota.
So please be aware of that and don't mail me about that . It isn't
much of a problem only the file isn't that big realy all 0 blocks are
not allocated on the disk.

Specifing a quota for a user or group
=====================================

Now use "edquota -u <username | uid>" to edit user quotas and "edquota
-g <groupname | gid>" to edit group quotas.

Edit only the numbers behind the soft and hard keywords. There are two lines
for each filesystem that has quota turned on. Soft means the softlimit, if
people or groups go over there softlimit they have some grace period to make
sure they go under there softlimit.

This is something you can change with "edquota -t"  and enter the number of
days there. If they don't remove it within there graceperiod it is counted as
a hardlimit. The hardlimit is the absolute maximum they can allocate, if they
want more the files are truncated.

The one line that says blocks is the number of blocks one can allocate,
the line that says inodes is the number of inodes (files/named pipes/
devices/etc.) one can allocate.

Adding users all with the same quota
====================================

Go to the dir where there homedirs reside. Do a edquota for one of the users
and change the quotas to the approriate values. This user becomes the prototype
user or group for all the others.Then do this:

# edquota -p <the_user_you_edited with the correct values> *

this should do the trick, all users now have the quota they need, now
you could edit the ones that still need other values.

Checking quotas for a user
==========================

Run the quota program. The syntax for this program is :

Usage: quota [-guqv]
       quota [-qv] -u username ...
       quota [-qv] -g groupname ...

Use -v to see the quotas on 1) filesystems you don't have quotas on
                            2) filesystems on which you do have quota
                               but haven't allocated any blocks yet

Use -q to only see filesystems on which you are over your softlimit or
have reached your hardlimit.

The -g flags give you all quotas for the groups you are in (also
additional groups).

Disabling quota for a user
==========================

When you want to disable quotas for a certain user use the quota editor
edquota. Type "edquota <username | uid>" or "edquota -g <groupname | gid>"
and set block softlimit and hardlimit, and the inode soft- and hardlimit to 0.
This should disable the quota for that user an the user can allocate as many
blocks and inodes as he/she wants.

Listing of the quotas used by all users on a filesystem

To get a  listing of all quotas in use on a certain filesystem or on any
filesystem you use the repquota program. This program needs to read the
quotafiles so I needs to be run by the superuser, or by any user if you 
have your quotafiles readable by everyone, this is not recomended.

Quotas on NFS-mounted disks
===========================

To have quotas on NFS filesystems, you need to install quotas on the
fileserver and not on the client. Clients can obtain quota information
with the quota command which does a query to the rquotad running on the
fileserver from which you mount your NFS disks. So don't put any
usrquota or grpquota flags in the flags for mounting NFS disks. Instead
install quotas on your fileserver. And start the rpc.rquotad from your
network rc-file.

BUGS
====

When you might find a bug please mail your bugreport to
quota-bugs@mcs.nl.mugnet.org. The bugreport should a least contain which version
of quota you use. And when you get a kernel panic please dont only send me the
output of the dump but also the relevant part of the zSystem.map. And if you
have diffs that cure problems you have also send them to this address.

