Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

LPI Linux Certification/Managing Disk Quota

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Detailed Objective Weight: 1 Description: Candidates should be able to manage disk quotas for users. Key knowledge area(s): Set up a disk quota for a filesystem. Edit, check and generate user quota reports. The following is a partial list of the used files, terms and utilities: quota edquota repquota quotaon Quotas On a system, root can manage the usage of disk space per user and per filesystems. The two limits that can be setup are: The soft limit (soft =) specifies the maximum amount of disk usage a quota user is allowed to have. The hard limit (hard =) specifies the absolute limit on the disk usage a quota user can't go beyond it. There is also the possibility to setup a grace period that will enforce the soft limit only after an amount of time specified. Setting up quotas for users 1) The keyword usrquota or/and grpquota must be added in file /etc/fstab for the partition interested. /dev/fd0 /home/yann/mnt auto rw,noauto,user,usrquota 0 0 /dev/hda5 /home ext2 defaults,usrquota,grpquota 1 2 2) Add in each root filesystems the file user.quota or/and group.quota. touch /mnt/aquota.user touch /home/aquota.user touch /home/aquota.group chmod 600 /mnt/aquota.user chmod 600 /home/aquota.user chmod 600 /home/aquota.group Only root can do the quota administration and once the empty files have been created some disk quota can be set such as: Soft limitation on number of files and inodes. Hard limitation on number of files and inodes if the grace time is set. Setting up quotas for users 3) Check the setting quotacheck -v mnt quotacheck: Scanning /dev/fd0 [/home/yann/mnt] done quotacheck: Checked 6 directories and 1 files 4) Enable quota on the disk quotaon -av /dev/fd0 [/home/yann/mnt]: user quotas turned on 5) Customize the disk quota limits: $ edquota -u yann Disk quotas for user yann (uid 500): Filesystem blocks soft hard inodes soft hard /dev/fd0 15 0 0 4 0 0 $ edquota -g yann $ edquota -t Grace period before enforcing soft limits for users: Time units may be: days, hours, minutes, or seconds Filesystem Block grace period Inode grace period /dev/fd0 7days 7days List quotas To list quotas for an user or group, use quota. quota [options] [user|group] Common options: -u:Default, print user quotas. -g:Print group quotas for the group of which the user is a member. -q: Print a more terse message, containing only information on filesystems where usage is over quota. Example: quota -u yann Display a quota report To display a quota report, use repquota. repquota [options] [user|group] Common options: -a: Report on all filesystems indicated in /etc/mtab to be read-write with quotas. -g: Report for group. Example: $ repquota /dev/fd0 *** Report for user quotas on device /dev/fd0 Block grace time: 7days; Inode grace time: 7days Block limits File limits User used soft hard grace used soft hard grace ---------------------------------------------------------------------- root -- 8 0 0 2 0 0 yann -- 15 0 0 4 0 0 Exercises Exercises results Setup a soft limitation for any users that have their home directory in /home to 500M. Change the grace time to 0. Log as the user and check if the limitation works. Linux