Typo
[linux_from_scratch_hints.git] / OLD / quotas.txt
blob47288cec9977e4a33b26f9f46e23e35517405fee
1 TITLE:          Quota Support
2 LFS VERSION:    3.3 + (maybe all)
3 AUTHOR:         Remco Jansen <remcorkz@xs4all.nl>
5 SYNOPSIS:
6         This hint describes how to setup quota support on your LFS system.
8 HINT:
10 Wrote this hint because there's one little thing that you may come across trying
11  to setup quota-tools. Normally on an LFS system the mtab file is created as a
12 symlink to /proc/mounts. The quota-tools programs won't work with this
13 configuration.
15 First make sure quota support is built into your kernel. If not, recompile your 
16 kernel.
18 Also you need to get the quota-tools package from
19 http://prdownloads.sourceforge.net/linuxquota/quota-3.08.tar.gz?download
20 (at the time of this writing version is 3.08).
21 Their homepage is can be found at http://sourceforge.net/projects/linuxquota/.
24 Install the quota-tools package as normally.
26 ./configure
29 Edit the Makefile by hand to setup the directories so that they obey the LFS
30 standard. (prefix=/bin, sysconfdir=/etc)
32 make && make install
35 Now the tools are installed properly, you have to change the /etc/mtab symlink
36 to the more-used /etc/mtab file.
37 (see http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0387.html
38 for more information on this issue)
40 rm -f /etc/mtab &&
41 touch /etc/mtab &&
42 chmod 644 /etc/mtab
45 In order to let the mtab file be accurate (also when the system has crashed for 
46 some reason) we add an mtab initialization part to the mountfs initscript.
48 Add the following lines to the start)-section of the mountfs initscript, right 
49 after the remounting of the root file system in read-write mode lines.
51                 # Because we have replaced the /etc/mtab-symlink by a file
52                 # we have to update the status of /etc/mtab.
53                 # First remove it. Then add an entry for the already
54                 # mounted root file system to it.
56                 echo "Clearing /etc/mtab..."
57                 : > /etc/mtab
58                 evaluate_retval
59                 echo "Update mtab file with root file system..."
60                 mount -f -o remount /
61                 evaluate_retval
62                 echo "Update mtab file with proc file system..."
63                 mount -f /proc
64                 evaluate_retval
67 Create the quota initscript as follows:
69 #!/bin/bash
70 # Begin $rc_base/init.d/quotas
72 # Based on sysklogd script from LFS-3.1 and earlier.
73 # Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
75 source /etc/sysconfig/rc
76 source $rc_functions
78 case "$1" in
79         start)
80                 echo "Checking quotas on all filesystems..."
81                 /usr/sbin/quotacheck -augM
82                 evaluate_retval
83                 echo "Turning quota administration on..."
84                 /usr/sbin/quotaon -aug
85                 evaluate_retval
86                 ;;
88         stop)
89                 echo "Turning off quota administration..."
90                 /usr/sbin/quotaoff -aug
91                 evaluate_retval
92                 ;;
94         restart)
95                 echo "Restarting quota administration not allowed."
96                 ;;
98         *)
99                 echo "Usage: $0 {start|stop|reload|restart|status}"
100                 exit 1
101                 ;;
102 esac
104 # End $rc_base/init.d/quotas
107 The last step is editing your /etc/fstab.
109 For each filesystem on which you want to enable quota support add either
110 usrquota or grpquota or the two of them to the options section of that file-
111 system. (for this information you can also have a look at one of the thousands
112 of quota how-to's)
114 Reboot your system. (You may also update the mtab file by issueing the
115 mount -f filesystem command for each already mounted filesystem, remount the 
116 filesystems on which you're installing quota support and then start quota 
117 administration by running quotaon -aug. However it is better to run the 
118 quotacheck tool as well... So if possible: reboot.)
120 The quotaon program will create the quota.user and/or quota.group files for each
121 desired filesystem automatically.
123 You're finished. Good luck.