Choose your kernel version and download the patch(es). Patch your kernel with the 'patch' command. If there is more than 1 patch for your kernel version, be sure to apply the patches in the correct order.
You can use this script ( I assume the downloaded patches are in /tmp/quota/ and the kernel has been untarred to /usr/src/linux) :
<code>
#!/bin/sh
gunzip /tmp/quota/*.gz
cd /usr/src/linux
COUNT=`ls -1 /tmp/quota/*.diff | wc -l`
for I in `seq 1 $COUNT`
do
patch -p1 < /tmp/quota/quota-2.4.21-$I-*.diff
done
</code>
<sect1>Reconfigure your kernel
<p>
Reconfigure your kernel and add quota support.
<p>Via `make menuconfig` or `make xconfig` you can find the option to support quota under the Filesystems-menu. You can specify extra options if you need them, like 32-bit UID support.
<p>Save the configuration and compile the kernel. Make sure the new kernel will be used when rebooting the system.
<sect1>Compile and install the quota softwares
<p>
To be able to use all the features of the new quota system, you'll probably need to download the new quota-package. Download the new quota software via the URL
provided above.
<p>
When downloaded do:
<code>$ gzip -dc <downloaded file> | tar xvf
$ cd quota-tools (or whatever directory the software is put in)
$ ./configure
$ make
$ su
# make install
</code>
<sect1>Modify your system init script to check quota and turn quota on at boot
time
<p>
Here's an example:
<code># Check quota and then turn quota on.
if [ -x /usr/sbin/quotacheck ]
then
echo "Checking quotas. This may take some time."
/usr/sbin/quotacheck -avug
echo " Done."
fi
if [ -x /usr/sbin/quotaon ]
then
echo "Turning on quota."
/usr/sbin/quotaon -avug
fi
</code>
The golden rule is that always turn quota on after your file systems in
/etc/fstab have been mounted, otherwise quota will fail to work. I recommend
turning quota on right after the part where file systems are mounted in your system init script.
<sect1>Modify /etc/fstab
<p>
Partitions that you have not yet enabled quota normally look something
like:
<code>/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /usr ext2 defaults 1 1
</code>
To enable user quota support on a file system, add "usrquota" to the fourth
field containing the word "defaults" (man fstab for details).
<code>/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /usr ext2 defaults,usrquota 1 1
</code>
Replace "usrquota" with "grpquota", should you need group quota support
on a file system.
<code>/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /usr ext2 defaults,grpquota 1 1
</code>
Need both user quota and group quota support on a file system?
To activate the quota software you have to reboot the system for the changes you have made
to take effect. The new kernel with quota support will be loaded and the startup scripts you've
just created will be executed. At first run, quotacheck will generate the appropiate files to maintain
the quota databases.
<sect1>Add quotacheck to crontab
<p>
Although quota should work with periodical checks, it sometimes helps to run quotacheck periodically, e.g. weekly. Add the following line to your root's crontab:
<code>0 3 * * 0 /sbin/quotacheck -avug
</code>
<sect>Quota setup: tools
<p>
This operation is performed with the edquota command (`man edquota` for details).
<sect1>Assigning quota for a particular user
<p>
Here's an example. I have a user with the login id bob on my system. The
command "edquota -u bob" takes me into vi (or editor specified in my $EDITOR
environment variable) to edit quota for user bob on each partition that has
quota enabled:
<code>Quotas for user bob:
/dev/hda3: blocks in use: 2594, limits (soft = 5000, hard = 6500)
inodes in use: 356, limits (soft = 1000, hard = 1500)
</code>
"blocks in use" is the total number of blocks (in kilobytes) a user has
consumed on a partition.
"inodes in use" is the total number of inodes a user has consumed on a partition.
<sect1>Assigning quota for a particular group
<p>
Now I have a group games on my system. "edquota -g games" takes me into
the vi editor again to edit quota for the group games:
<code> Quotas for group games:
/dev/hda4: blocks in use: 5799, limits (soft = 8000, hard = 10000)
inodes in use: 1454, limits (soft = 3000, hard = 4000)
</code>
<sect1>Assigning quota for a bunch of users with the same value
<p>
To rapidly set quotas for, say 100 users, on my system to the same value
as my user bob, I would first edit bob's quota information by hand, then execute: