Beruflich Dokumente
Kultur Dokumente
Note
This chapter is for all file systems, however some file systems have their own quota
management tools. Refer to the corresponding description for the applicable file systems.
For XFS file systems, refer to Section 6.3, XFS Quota Management .
Btrfs does not have disk quotas so is not covered.
Add the usrq uo ta and/or g rpq uo ta options to the file systems that require quotas:
114
Examp le 16 .2. Ad d q u o t as
/dev/VolGroup00/LogVol00
LABEL=/boot
none
none
none
none
/dev/VolGroup00/LogVol02
1 2
/dev/VolGroup00/LogVol01
/
/boot
/dev/pts
/dev/shm
/proc
/sys
/home
ext3
defaults
1 1
ext3
defaults
1 2
devpts gid=5,mode=620 0 0
tmpfs
defaults
0 0
proc
defaults
0 0
sysfs
defaults
0 0
ext3
defaults,usrquota,grpquota
swap
swap
defaults
0 0 . . .
In this example, the /ho me file system has both user and group quotas enabled.
Note
The following examples assume that a separate /ho me partition was created during the
installation of Red Hat Enterprise Linux. The root (/) partition can be used for setting quota
policies in the /etc/fstab file.
Note
The q uo tacheck command has no effect on XFS as the table of disk usage is completed
automatically at mount time. Refer to the man page xfs_q uo ta(8) for more information.
115
Red Hat Ent erprise Linux 7 St orage Administ rat ion G uide
To create the quota files (aq uo ta. user and aq uo ta. g ro up) on the file system, use the -c option
of the q uo tacheck command.
The -c option specifies that the quota files should be created for each file system with quotas
enabled, the -u option specifies to check for user quotas, and the -g option specifies to check for
group quotas.
If neither the -u or -g options are specified, only the user quota file is created. If only -g is specified,
only the group quota file is created.
After the files are created, run the following command to generate the table of current disk usage per
file system with quotas enabled:
# q uo tacheck -avug
The options used are as follows:
a
Check all quota-enabled, locally-mounted file systems
v
Display verbose status information as the quota check proceeds
u
Check user disk quota information
g
Check group disk quota information
After q uo tacheck has finished running, the quota files corresponding to the enabled quotas (user
and/or group) are populated with data for each quota-enabled locally-mounted file system such as
/ho me.
116
hard
inodes
soft
37418
Note
The text editor defined by the ED IT O R environment variable is used by ed q uo ta. To change
the editor, set the ED IT O R environment variable in your ~ /. bash_pro fi l e file to the full
path of the editor of your choice.
The first column is the name of the file system that has a quota enabled for it. The second column
shows how many blocks the user is currently using. The next two columns are used to set soft and
hard block limits for the user on the file system. The i no d es column shows how many inodes the
user is currently using. The last two columns are used to set the soft and hard inode limits for the
user on the file system.
The hard block limit is the absolute maximum amount of disk space that a user or group can use.
Once this limit is reached, no further disk space can be used.
The soft block limit defines the maximum amount of disk space that can be used. However, unlike the
hard limit, the soft limit can be exceeded for a certain amount of time. That time is known as the grace
period. The grace period can be expressed in seconds, minutes, hours, days, weeks, or months.
If any of the values are set to 0, that limit is not set. In the text editor, change the desired limits.
hard
inodes
550000
37418
soft
0
To verify that the quota for the user has been set, use the command:
# quota username
Disk quotas for user username (uid 501):
Filesystem blocks
quota
limit
grace
grace
/dev/sdb
1000*
1000
1000
files
quota
limit
117
Red Hat Ent erprise Linux 7 St orage Administ rat ion G uide
# ed q uo ta -g d evel
This command displays the existing quota for the group in the text editor:
Disk quotas for group devel (gid 505):
Filesystem
blocks
soft
hard
/dev/VolGroup00/LogVol02 440400
0
0
hard
0
inodes
37418
soft
0
Important
While other ed q uo ta commands operate on quotas for a particular user or group, the -t
option operates on every file system with quotas enabled.
118
To enable quotas again, use the q uo tao n command with the same options.
For example, to enable user and group quotas for all file systems, use the following command:
# q uo tao n -vaug
To enable quotas for a specific file system, such as /ho me, use the following command:
# q uo tao n -vug /ho me
If neither the -u or -g options are specified, only the user quotas are enabled. If only -g is specified,
only group quotas are enabled.
Note
The q uo tao n command is not always needed for XFS because it is performed automatically
at mount time. Refer to the man page q uo tao n(8) for more information.
To view the disk usage report for all (option -a) quota-enabled file systems, use the command:
# repq uo ta -a
While the report is easy to read, a few points should be explained. The -- displayed after each user
is a quick way to determine whether the block or inode limits have been exceeded. If either soft limit is
exceeded, a + appears in place of the corresponding -; the first - represents the block limit, and the
second represents the inode limit.
The g race columns are normally blank. If a soft limit has been exceeded, the column contains a time
specification equal to the amount of time remaining on the grace period. If the grace period has
expired, no ne appears in its place.
119
Red Hat Ent erprise Linux 7 St orage Administ rat ion G uide
When a file system fails to unmount cleanly (due to a system crash, for example), it is necessary to
run q uo tacheck. However, q uo tacheck can be run on a regular basis, even if the system has not
crashed. Safe methods for periodically running q uo tacheck include:
En su rin g q u o t ach eck ru n s o n n ext reb o o t
Warning
Running q uo tacheck on a live file system mounted read-write is not recommended
due to the possibility of quota file corruption.
Refer to man cro n for more information about configuring cro n.
120
ed q uo ta
repq uo ta
q uo ta
q uo tao n
q uo tao ff
121