[ Pobierz całość w formacie PDF ]
mount the file system with the quota=account option specified.
mount -o quota=account BlockDevice MountPoint
To mount a file system with quotas disabled, mount the file system with the quota=off option
specified. This is the default setting.
mount -o quota=off BlockDevice MountPoint
quota={on|off|account}
on - Specifies that quotas are enabled when the file system is mounted.
off - Specifies that quotas are disabled when the file system is mounted.
account - Specifies that user and group usage statistics are maintained by the file system,
even though the quota limits are not enforced.
BlockDevice
Specifies the block device where the GFS2 file system resides.
MountPoint
Specifies the directory where the GFS2 file system should be mounted.
Examples
In this example, the GFS2 file system on /dev/vg01/lvol0 is mounted on the /mygfs2 directory with
quotas enabled.
mount -o quota=on /dev/vg01/lvol0 /mygfs2
In this example, the GFS2 file system on /dev/vg01/lvol0 is mounted on the /mygfs2 directory with
quota accounting maintained, but not enforced.
mount -o quota=account /dev/vg01/lvol0 /mygfs2
40
Usage
4 .5.1.2. Creating the Quota Database Files
After each quota-enabled file system is mounted, the system is capable of working with disk quotas.
However, the file system itself is not yet ready to support quotas. The next step is to run the
quotacheck command.
The quotacheck command examines quota-enabled file systems and builds a table of the current disk
usage per file system. The table is then used to update the operating system's copy of disk usage. In
addition, the file system's disk quota files are updated.
To create the quota files on the file system, use the -u and the -g options of the quotacheck
command; both of these options must be specified for user and group quotas to be initialized. For
example, if quotas are enabled for the /home file system, create the files in the /home directory:
quotacheck -ug /home
4 .5.1.3. Assigning Quotas per User
The last step is assigning the disk quotas with the edquota command. Note that if you have mounted
your file system in accounting mode (with the quota=account option specified), the quotas are not
enforced.
To configure the quota for a user, as root in a shell prompt, execute the command:
edquota username
Perform this step for each user who needs a quota. For example, if a quota is enabled in /etc/fstab
for the /home partition (/dev/VolGroup00/LogVol02 in the example below) and the command
edquota testuser is executed, the following is shown in the editor configured as the default for the
system:
Disk quotas for user testuser (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/VolGroup00/LogVol02 440436 0 0
Note
The text editor defined by the EDITOR environment variable is used by edquota. To change the
editor, set the EDITOR environment variable in your ~/.bash_profile 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 soft block limit defines the maximum amount of disk space that can be used.
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 GFS2 file system does not maintain quotas for inodes, so these columns do not apply to GFS2 file
systems and will be blank.
41
Red Hat Enterprise Linux 6 Global File System 2
If any of the values are set to 0, that limit is not set. In the text editor, change the desired limits. For
example:
Disk quotas for user testuser (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/VolGroup00/LogVol02 440436 500000 550000
To verify that the quota for the user has been set, use the command:
quota testuser
4 .5.1.4 . Assigning Quotas per Group
Quotas can also be assigned on a per-group basis. Note that if you have mounted your file system in
accounting mode (with the account=on option specified), the quotas are not enforced.
To set a group quota for the devel group (the group must exist prior to setting the group quota), use
the following command:
edquota -g devel
This command displays the existing quota for the group in the text editor:
Disk quotas for group devel (gid 505):
Filesystem blocks soft hard inodes soft hard
/dev/VolGroup00/LogVol02 440400 0 0
The GFS2 file system does not maintain quotas for inodes, so these columns do not apply to GFS2 file
systems and will be blank. Modify the limits, then save the file.
To verify that the group quota has been set, use the following command:
quota -g devel
4.5.2. Managing Disk Quotas
If quotas are implemented, they need some maintenance mostly in the form of watching to see if the
quotas are exceeded and making sure the quotas are accurate.
Of course, if users repeatedly exceed their quotas or consistently reach their soft limits, a system
administrator has a few choices to make depending on what type of users they are and how much disk
space impacts their work. The administrator can either help the user determine how to use less disk
space or increase the user's disk quota.
You can create a disk usage report by running the repquota utility. For example, the command
repquota /hom e produces this output:
*** Report for user quotas on device /dev/mapper/VolGroup00-LogVol02
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 36 0 0 4 0 0
kristin -- 540 0 0 125 0 0
testuser -- 440400 500000 550000 37418 0 0
42
Usage
To view the disk usage report for all (option -a) quota-enabled file systems, use the command:
repquota -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 limits have been exceeded. If the block soft limit is exceeded, a
[ Pobierz całość w formacie PDF ]