Setting quotas for users on a per-project basis
A file system must be properly configured in order to set quotas for users. Use this information to set quotas for any number of users on a per-project basis across protocols.
- Ensure the file system is configured correctly to use quotas:
- The -Q yes option must be in effect for the file system.
- To set default quotas at the fileset level, the --perfileset-quota option
must also be in effect.Note: If --perfileset-quota is in effect, all users and groups in the fileset root will not be impacted by default quota unless they are explicitly set.
Here are some examples:- A GPFS™ cluster is created with configuration profile file,
example.profile, which contains the following lines:
When a file system is created, those quota attributes will be set automatically. Quota accounting will be enabled on a perfileset basis for users and groups, and quotas will automatically be enforced. This means that when a quota is reached, the end user will not be able to add more data to the file system.%filesystem quotasAccountingEnabled=yes quotasEnforced=user;group;fileset perfilesetQuotas=yes
mmcrfs fs5 nsd8
A listing of the file system config, using the mmlsfs command, will show the following attributes and values, having been set by the mmcrfs command:
mmlsfs fs5
... -Q user;group;fileset Quotas accounting enabled user;group;fileset Quotas enforced none Default quotas enabled --perfileset-quota Yes Per-fileset quota enforcement ....
- Whether or not a GPFS cluster was created with a
configuration profile file, a GPFS file system can be created
with the quota attributes to be set. This can be done by calling the configuration profile file
explicitly from the command line:
mmcrfs fs6 nsd9 --profile=example
For more information on user-defined profiles, see mmcrfs command.
- Create a fileset on the file system for the project using the mmcrfileset command.
For example:
mmcrfileset fs5 projectX --inode-space=newNote: It is recommended to create an independent fileset for the project. - Link the fileset using the mmlinkfileset command.
The file system, fs5, must be mounted, using the mmmount command. For example:
mmmount fs5 -a
mmchfs fs5 --inode-limit 400000:300000
Output:Set maxInodes for inode space 0 to 400000 Fileset root changed.
mmlinkfileset fs5 projectX -J /gpfs/fs5/projectX
- Create export/share using the newly created fileset as the export/share
path. For more information,
see the mmnfs command and the mmsmb command. For example:
mmnfs export add /gpfs/fs5/projectX
- If needed, specify absolute fileset inode limits using the mmchfileset command.
A fileset inode limit is analogous to saying this is how many files
and directories the project is likely to produce. This is not something
that can be easily recommended. Nonetheless, here is an example of
how that can be set and listed for the file system and fileset:
mmchfileset fs5 projectX --inode-limit 200000
Output:Set maxInodes for inode space 1 to 200000 Fileset projectX changed.
mmlsfileset fs5 -L
Output:Filesets in file system 'fs5': Name Id RootInode ParentId Created Inode Space MaxInodes AllocInodes Comment root 0 3 -- Sat Mar 28 13:40:33 2015 0 400000 310656 root fileset projectX 1 524291 -- Sat Mar 28 14:54:13 2015 1 200000 100032
- Now that there is a fileset limit in place, which is entirely
optional, to set group quota limits on the project, that is, on fileset projectX on
file system fs5, use the mmsetquota command. For example,
if the group groupY will access projectX:
mmsetquota fs5:projectX --group groupY --block 128G --files 150K
Here, the perfileset quota needs to be enabled on fs5 as in step 1, and the group groupY must have a GID (group ID) on the GPFS cluster. The block parameter is used to specify the maximum size of the data on the storage device and the files parameter is used to specify the maximum number for files (or directories) the groupY is able to consume or create on projectX, a fileset of file system fs5 that is exported through NFS in this example.
At this point, the quota accounting needs to be refreshed on the file system using the mmcheckquota command, and then a reporting of the quota limits on projectX can take place using the mmrepquota command. For example:
mmcheckquota fs5
mmrepquota fs5:projectX
Output:Block Limits | File Limits Name fileset type KB quota limit in_doubt grace | files quota limit in_doubt grace root projectX USR 0 0 0 0 none | 1 0 0 0 none root projectX GRP 0 0 0 0 none | 1 0 0 0 none groupY projectX GRP 0 134217728 0 0 none | 0 153600 0 0 none
- If the project grows, or shrinks, and quota changes at the group
level are needed, the mmsetquota command can again be used
to change the quotas for groupY on projectX. For example,
if the expected limits for projectX doubles:
mmsetquota fs5:projectX --group groupY --block 256G --files 300K
mmrepquota fs5:projectX
Output:Block Limits | File Limits Name fileset type KB quota limit in_doubt grace | files quota limit in_doubt grace root projectX USR 0 0 0 0 none | 1 0 0 0 none root projectX GRP 0 0 0 0 none | 1 0 0 0 none groupY projectX GRP 0 268435456 0 0 none | 0 307200 0 0 none
- If the project is projected to exceed the inode limits for the fileset and file system, then these can also be adjusted upwards. For more information, see mmchfs command.