HOWTO - User quotas under freeVSD ================================= Introduction ============ This document explains how to add quota support. It is advised that you read this document before using this function. For a more in-depth understanding of freeVSD please refer to the following documents: user-guide.txt details on the installation and administration of freeVSD and virtual servers protocol.txt detailed information on the freeVSD protocol faq.txt frequently asked questions on freeVSD security.txt notes about freeVSD security issues NEWS list of developments in the current version as well as past verisons of freeVSD. README essential information about freeVSD INSTALL generic installation notes HOWTOmod_bind.txt a brief HOWTO on the 'mod_bind' module in freeVSD. In order to allow user quotas under freeVSD, your kernel must be compiled with Quota support. We recommend a "server" installation of Red Hat 6.2 as the hosting server on which to install freeVSD. However, the kernel installed with Red Hat 6.2 does not have Quota support compiled in. This document describes how to recompile your kernel to use quota support. WARNING: Recompiling your kernel is a very dangerous operation and should only be attempted by experienced system administrators - a backup kernel should always be kept as a boot option in case your new kernel fails. The instructions below illustrate how to back up your existing kernel - we urge you to follow these instructions carefully. We cannot guarantee a successful operation of quotas unless the instructions as provided in this document are correctly followed. Enabling Quota Support ====================== You must make sure that you have made a clean server installation of Red Hat 6.2. The steps required to rebuild your kernel may differ for other versions of Red Hat and other Linux distributions. NOTE: RedHat 6.2 ships with Linux kernel version 2.2.14-5.0. These instructions refer to version 2.2.15, although you may use any appropriate kernel version you choose. 1. Log in to the server as root. Alternatively, you can log in using the su function. 2. Download the source for the kernel version you wish to build. TIP: The kernel source is best downloaded from ftp.xx.kernel.org, where xx is your country code (e.g. uk if you are based in the UK). The source can be found on the ftp server in the site under /pub/linux/kernel/va.b/ where a.b is the appropriate version number of the kernal. You can then download the source in gzipped format (*.tar.gz). 3. Your system may include a directory (or a softlink) /usr/src/linux. This directory contains the existing source for your current kernel. We recommend that if disk space allows, you backup this directory, using a name that will identify it as the old kernel source. 4. Now, change to the /usr/src directory and untar the source as follows: tar zxpvf linux-x.y.z.tar.gz The source for the new kernel will be unpacked to the directory /usr/src/linux 5. Open the README file from the newly-created directory /usr/src/linux. Read this file VERY CAREFULLY and follow the instructions to build, install and boot your system with the new kernel. 6. To enable quotas, make sure that you run "make menuconfig" at the appropriate point according to the instructions in the README file. When running "make menuconfig", turn on quotas by checking the "Quota Support" option under the "Filesystems" menu. Recompiling your kernel in this manner will usually ensure that all drivers for hardware are properly installed. However, for users with unsupported or non-standard hardware, additional changes to the kernel configuration may be required that may require obtaining new drivers for your hardware. Discussing the range of possible kernel configurations or any potential compilation and operation problems are beyond the scope of this document. You should consult appropriate manuals or web sites relating to these issues. 6. Once your new kernel is built, installed and fully functioning, you may enable quotas in your Linux server filesystems. Firstly, it is necessary to edit the filesystems table. Open /etc/fstab - and an entry for your root filesystem is shown as in the following example: /dev/hda1 / ext2 defaults 1 1 To enable user and group quotas on the root filesystem, modify this entry as follows: /dev/hda1 / ext2 defaults,usrquota,grpquota 1 1 This process should be repeated for each filesystem containing Virtual Servers for which you wish to enable quotas. 7. It is necessary to create quota.user and quota.group files for each filesystem. This is achieved by running the following command quotacheck -avug This will perform a scan of disk usage on all filesystems, and will create quota.user and quota.group files in the root directory of each filesystem. These files should be 'chowned' to root.root owned and 'chmoded' to 600 if they are not already. 8. The final configuration change required is to tell your server to enable quotas at boot time. With a standard Red Hat 6.2 server installation, the server will attempt to enable quotas at boot time for all filesystems, whether or not quotas are enabled. However, you may wish to perform other functions at boot time. One example is to modify etc/rc.d/rc.sysinit to enable quotas only after a quotacheck on the hosting server has been performed: # 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 9. The server should be rebooted in order for the changes to take effect. Quotas are now enabled on your hosting server. 10. To check that the quotas have been enabled, create a Virtual Server and enter the virtual server by using the bevs command. Complete the process by running quotastats.