[ start | index | login ]
start > knowledgebase > linux > misc > disk quotas

disk quotas

Created by retep. Last edited by retep, 2 years and 271 days ago. Viewed 5,572 times. #4
[diff] [history] [edit] [rdf]
labels
attachments

Disk Quotas

Disk quotas let you set the maximum amount of disk space a particular user is allowed to have on your server. The disk space used by a user is the sum of all the file sizes owned by their user id.

Enabling Disk Quotas Via /etc/fstab

Disk quotas will only work if you have set a quota option in your /etc/fstab.

You need to have a usrquota and/or grpquota option on the file system on which you wish to use quotas. e.g. in /etc/fstab you would have something like:

/dev/ubd0 / ext3 defaults,noatime,usrquota,grpquota 1 0

The ubd0 bit may be something like ubd1, sda1, hda1 etc. Leave that part alone in your /etc/fstab. Just add the usrquota,grpquota part.

Setting Up Disk Quotas

Then:

# reload the mount points with the quota settings enabled
mount -o remount /

#install quota (if not there alread) apt-get install quota

# will set up the quota files quotacheck -acguvm

# -m is needed, else you may get: # quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right. # Please stop all programs writing to filesystem or use -m flag to force checking.

# -c is needed, else you may get an error like # quotacheck: Can't find filesystem to check or filesystem not mounted with quota # edquota: Quota file not found or has wrong format. # quota: Quota file not found or has wrong format.

# should happen on reboot (in /etc/rc.d/rc.sysinit) quotaon -avug

Using Disk Quotas

Now if you run:

repquota -a

It will show how much disk space each user is using.

To assign a quota to a user (per >>http://www.tldp.org/HOWTO/Quota-4.html):

edquota -u ausername
no comments | post comment
Powered by snipsnap.org Found a mistake in a howto? Let us know via an email to p.blikibugs at rimuhosting com.