Difference between revisions of "Linux Quotas"

 
(7 intermediate revisions by the same user not shown)
Line 13: Line 13:
  
 
To enable user quota support on a file system, add ,usrquota to the fourth field containing the word "defaults" (man fstab for details).
 
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,usrquota        1      1
+
  /dev/hda1      /      ext2    defaults''',usrquota'''       1      1
  /dev/hda2      /usr    ext2    defaults,usrquota      1      1
+
  /dev/hda2      /usr    ext2    defaults''',usrquota'''       1      1
  
 
=== Enable quotas on startup ===
 
=== Enable quotas on startup ===
 
Edit /etc/rc.local and add the following command.
 
Edit /etc/rc.local and add the following command.
 
  quotaon -a
 
  quotaon -a
 
  
 
=== Add weekly quota check ===
 
=== Add weekly quota check ===
Edit /etc/crontab and add a the following command.
+
Edit /etc/crontab and add the following command.
 
  0  3  *  *  0 quotaoff -a;/sbin/quotacheck -aum;quotaon -a;
 
  0  3  *  *  0 quotaoff -a;/sbin/quotacheck -aum;quotaon -a;
  
Line 32: Line 31:
  
 
== Debian / Ubuntu ==
 
== Debian / Ubuntu ==
 +
=== Install quota ===
 +
Run the following command to install the quota package.
 +
apt-get install quota
 +
 +
=== Modify /etc/fstab ===
 +
Enable quotas on the partitions in /etc/fstab. Partitions that do not have quotas enabled 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''',usrquota'''        1      1
 +
/dev/hda2      /usr    ext2    defaults''',usrquota'''      1      1
 +
 +
=== Restart and create quota database ===
 +
Restart your server to activate quotas. After restarting execute the following commands.
 +
quotaoff -a
 +
quotacheck -caum
 +
quotaon -a

Latest revision as of 03:09, 10 March 2012

How to Set Up User Quotas

The following instructions are provided for your convenience. We are not responsible for errors caused by these instructions and we do not provide support for configuring quotas. For detailed instructions read the reference manual for your distro.

CentOS / Fedora / Redhat

Install quota

Run the following command to install the quota package.

yum install quota

Modify /etc/fstab

Enable quotas on the partitions in /etc/fstab. Partitions that do not have quotas enabled 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,usrquota        1       1
/dev/hda2       /usr    ext2    defaults,usrquota       1       1

Enable quotas on startup

Edit /etc/rc.local and add the following command.

quotaon -a

Add weekly quota check

Edit /etc/crontab and add the following command.

0  3  *  *  0 quotaoff -a;/sbin/quotacheck -aum;quotaon -a;

Restart and create quota database

Restart your server to activate quotas. After restarting execute the following commands.

quotaoff -a
quotacheck -caum
quotaon -a

Debian / Ubuntu

Install quota

Run the following command to install the quota package.

apt-get install quota

Modify /etc/fstab

Enable quotas on the partitions in /etc/fstab. Partitions that do not have quotas enabled 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,usrquota        1       1
/dev/hda2       /usr    ext2    defaults,usrquota       1       1

Restart and create quota database

Restart your server to activate quotas. After restarting execute the following commands.

quotaoff -a
quotacheck -caum
quotaon -a
Retrieved from "https://help.tcadmin.com/index.php?title=Linux_Quotas&oldid=647"