Disk Quotas - Howto

The disk quota feature of allows the system administrator to allocate a maximum amount of disk space a user or group may use. It is applied per filesystem. The default Linux Kernel which comes with Redhat and Fedora Core comes with quota support compiled in.

Perform the following as root:

1) Edit file /etc/ to add qualifier "usrquota" or "grpquota" to the partition.

To enable user quota support on a , add "usrquota" to the fourth field containing the word "defaults".

/dev/hda2 /home defaults,usrquota 1 1

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

/dev/hda2 /home ext3 defaults,grpquota 1 1

Or both user quota and group quota support:

/dev/hda2 /home ext3 defaults,usrquota,grpquota 1 1

2) Enable user and group quotas support on the /home file system. quotacheck –c /home

Quota file names:

Version 2 (Linux 2.4/2.6 kernel): aquota.user, aquota.group Version 1 (Linux 2.2 kernel): quota.user, quota.group

On some systems you might have to manually create these files using touch and chmod 600 the files with root as owner. The files can be converted/upgraded using the convertquota command.

3) Reboot (shutdown -r now ) or re-mount the file system (mount -o remount /partition). Check /etc/mtab, the partition will show up in the list of mounted filesystems as having quotas.

/dev/hda5 / ext3 rw,usrquota 0 0

3) Quotacheck is used to scan a file system for disk usages, and updates the quota record file "quota.user/aquota.user" to the most recent state. System Response: /dev/hda6: user quotas turned on quotacheck -vgum /partition (or –vguma) Disk Quotas - Howto

4) Man page: quotaon - turn filesystem quotas on and off quotaon –av – this command also needs to be specified on system startup quotaon - enable disk quotas on a file system. This command should be added to system startup. quotaoff - turn off disk quotas for a file system. Used only for maintenance.

5) Set user or group quotas edquota -u user_id edquota uses vi editor commands.

For example: edquota -u user1

Disk quotas for user user1 (uid 501):

Filesystem blocks soft hard inodes soft hard /dev/hda5 1944 0 0 120 0 0 blocks: 1k blocks inodes: Number of entries in directory file soft: Max number of blocks/inodes user may have on partition before warning is issued and grace persiod countdown begins. hard: Max number of blocks/inodes user may have on partition.

If set to "0" (zero) then no limit is enforced.

If editing group quotas: edquota -g group_name

6) Check quote setup quota -u user_id - List quotas quota - display disk usage and limits repquota - summarize quotas for a filesystem.