Hi,

I'm trying to get some GFS2-related information out in a release note for 
Fedora 15. I'd greatly appreciate it if somebody can help me out with getting 
this in.

GFS2 recently implemented a quota feature that allows the generic filesystem 
quota tools to interact with GFS2 in addition to the already supported 
gfs2_quota tool for manipulating disk quotas. 
https://bugzilla.redhat.com/show_bug.cgi?id=596794 was the development bugzilla 
used to track this.

This has been documented for RHEL6.1 in the GFS2 manual. I'm not sure what 
level of detail needs to go into the Fedora release notes, but I'm attaching 
the relevant section from the RHEL gfs2 manual for reference. If you need more 
information please let me know.

Thanks!
--Abhi Das

Red Hat Filesystems
3.5 GFS2 Quota Management

File-system quotas are used to limit the amount of file system space a user or 
group can use. A user or group does not have a quota limit until one is set. 
When a GFS2 file system is mounted with the quota=on or quota=account option, 
GFS2 keeps track of the space used by each user and group even when there are 
no limits in place. GFS2 updates quota information in a transactional way so 
system crashes do not require quota usages to be reconstructed.

To prevent a performance slowdown, a GFS2 node synchronizes updates to the 
quota file only periodically. The "fuzzy" quota accounting can allow users or 
groups to slightly exceed the set limit. To minimize this, GFS2 dynamically 
reduces the synchronization period as a "hard" quota limit is approached. 

Note:
As of the Fedora 15 release, GFS2 supports the standard Linux quota facilities. 
In order to use this you will need to install the quota RPM. This is the 
preferred way to administer quotas on GFS2 and should be used for all new 
deployments of GFS2 using quotas. This section documents GFS2 quota management 
using these facilities.
For earlier releases of Fedora, GFS2 required the gfs2_quota command to manage 
quotas.

3.5.1. Configuring Disk Quotas
To implement disk quotas, use the following steps:

   1.
      Set up quotas in enforcement or accounting mode.
   2.
      Initialize the quota database file with current block usage information.
   3.
      Assign quota policies. (In accounting mode, these policies are not 
enforced.) 

Each of these steps is discussed in detail in the following sections.

3.5.1.1. Setting Up Quotas in Enforcement or Accounting Mode

In GFS2 file systems, quotas are disabled by default. To enable quotas for a 
file system, mount the file system with the quota=on option specified.
It is possible to keep track of disk usage and maintain quota accounting for 
every user and group without enforcing the limit and warn values. To do this, 
mount the file system with the quota=account option specified.
Usage
To mount a file system with quotas enabled, mount the file system with the 
quota=on option specified.

mount -o quota=on BlockDevice MountPoint

To mount a file system with quota accounting maintained, even though the quota 
limits are not enforced, 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 or 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

3.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

3.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.
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

3.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

3.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 /home 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

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 + appears in place 
of the the first - in the output. The second - indicates the inode limit, but 
GFS2 file systems do not support inode limits so that character will remain as 
-. GFS2 file systems do not support a grace period, so the grace column will 
remain blank.

Note that the repquota command is not supported over NFS, irrespective of the 
underlying file system. 

3.5.3. Keeping Quotas Accurate
If you enable quotas on your file system after a period of time when you have 
been running with quotas disabled, you should run the quotacheck command to 
create, check, and repair quota files. Additionally, you may want to run the 
quotacheck if you think your quota files may not be accurate, as may occur when 
a file system is not unmounted cleanly after a system crash.
For more information about the quotacheck command, see the quotacheck man page.

Note:
Run quotacheck when the file system is relatively idle on all nodes because 
disk activity may throw off the computed quota values 

3.5.4. Synchronizing Quotas with the quotasync Command

GFS2 stores all quota information in its own internal file on disk. A GFS2 node 
does not update this quota file for every file system write; rather, by default 
it updates the quota file once every 60 seconds. This is necessary to avoid 
contention among nodes writing to the quota file, which would cause a slowdown 
in performance.

As a user or group approaches their quota limit, GFS2 dynamically reduces the 
time between its quota-file updates to prevent the limit from being exceeded. 
The normal time period between quota synchronizations is a tunable parameter, 
quota_quantum, and can be changed using the gfs2_tool command from its default 
value of 60 seconds. Also, the quota_quantum parameter must be set on each node 
and each time the file system is mounted. (Changes to the quota_quantum 
parameter are not persistent across unmounts.)

You can use the quotasync command to synchronize the quota information from a 
node to the on-disk quota file between the automatic updates performed by GFS2.

Usage
Synchronizing Quota Information

quotasync [-ug] -a|mntpnt...

u
    Sync the user quota files. 
g
    Sync the group quota files 
a
    Sync all filesystems that are currently quota-enabled and support sync. 
When this parameter is absent, a filesystem mountpoint should be specified. 
mntpnt
    Specifies the GFS2 file system to which the actions apply. 

Tuning the Time Between Synchronizations

gfs2_tool settune MountPoint quota_quantum Seconds

MountPoint
    Specifies the GFS2 file system to which the actions apply. 
Seconds
    Specifies the new time period between regular quota-file synchronizations 
by GFS2. Smaller values may increase contention and slow down performance. 

Examples
This example synchronizes all the cached dirty quotas from the node it is run 
on to the ondisk quota file for the file system /mnt/mygfs2.

# quotasync -ug /mnt/mygfs2

This example changes the default time period between regular quota-file updates 
to one hour (3600 seconds) for file system /mnt/mygfs2 on a single node.

gfs2_tool settune /mnt/mygfs2 quota_quantum 3600

3.5.5. References

For more information on disk quotas, refer to the man pages of the following 
commands:

    *
      quotacheck
    *
      edquota
    *
      repquota
    *
      quota 
--
relnotes-content mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/relnotes-content

Reply via email to