The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

Next Previous Contents

4. Quota Setup on Linux - Part I: The Configuration

4.1 Patch the kernel

Download the patch for your kernel at:


ftp://atrey.karlin.mff.cuni.cz/pub/local/jack/quota/

Choose your kernel version and download the patch. Patch your kernel with the 'patch' command.

4.2 Reconfigure your kernel

Reconfigure your kernel and add quota support by typing y to:


Quota support (CONFIG_QUOTA) [n] y

Via `make menuconfig` of `make xconfig` you can find the option to support quota under the Filesystems-menu.

Make sure the new kernel will be used when rebooting the system.

4.3 Compile and install the quota softwares

If the quota package is already in your Linux distribution, you don't have to install the quota software. If the quota package is not available in your Linux distribution, or if you wan't to install the most recent version, you can download the latest version of the quota software source from the location mentioned above.

When downloaded do:


$ gzip -dc <downloaded file> | tar xvf 
$ cd quota-tools  (or whatever directory the software is put in)
$ ./configure
$ make
$ su
# make install

4.4 Modify your system init script to check quota and turn quota on at boot time

Here's an example:


# 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

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.

4.5 Modify /etc/fstab

Partitions that you have not yet enabled quota normally look something like:


/dev/hda1       /       ext2    defaults        1       1
/dev/hda2       /usr    ext2    defaults        1       1

To enable user quota support on a file system, add "usrquota" to the fourth field containing the word "defaults" (man fstab for details).


/dev/hda1       /       ext2    defaults        1       1
/dev/hda2       /usr    ext2    defaults,usrquota       1       1

Replace "usrquota" with "grpquota", should you need group quota support on a file system.


/dev/hda1       /       ext2    defaults        1       1
/dev/hda2       /usr    ext2    defaults,grpquota       1       1

Need both user quota and group quota support on a file system?


/dev/hda1       /       ext2    defaults        1       1
/dev/hda2       /usr    ext2    defaults,usrquota,grpquota       1   1

4.6 Activate the quota 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.

Add quotacheck to crontab

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:


0 3 * * 0 /sbin/quotacheck -avug


Next Previous Contents


Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру