X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=ConfiguringQuotas.xml;h=d299d786f67b6e7a5a603c3af92783a3925b20ee;hb=5b911534777ba9fe568cd837bf25af611fed2af3;hp=c68d7195f94a3b260e333ec9a658c552a16f6c12;hpb=94a7200a3ff84a5444b0ead0c54f3c0a5fe83013;p=doc%2Fmanual.git diff --git a/ConfiguringQuotas.xml b/ConfiguringQuotas.xml index c68d719..d299d78 100644 --- a/ConfiguringQuotas.xml +++ b/ConfiguringQuotas.xml @@ -10,14 +10,14 @@ xml:id="configuringquotas"> Quotas configuring Working with Quotas - Quotas allow a system administrator to limit the amount of disk space - a user or group can use. Quotas are set by root, and can be specified for - individual users and/or groups. Before a file is written to a partition - where quotas are set, the quota of the creator's group is checked. If a - quota exists, then the file size counts towards the group's quota. If no - quota exists, then the owner's user quota is checked before the file is - written. Similarly, inode usage for specific functions can be controlled if - a user over-uses the allocated space. + Quotas allow a system administrator to limit the amount of disk + space a user, group, or project can use. Quotas are set by root, and can + be specified for individual users, groups, and/or projects. Before a file + is written to a partition where quotas are set, the quota of the creator's + group is checked. If a quota exists, then the file size counts towards + the group's quota. If no quota exists, then the owner's user quota is + checked before the file is written. Similarly, inode usage for specific + functions can be controlled if a user over-uses the allocated space. Lustre quota enforcement differs from standard Linux quota enforcement in several ways: @@ -43,9 +43,9 @@ xml:id="configuringquotas"> resolution. - Accuracy: quota information is distributed throughout -the file system and can only be accurately calculated with a completely -quite file system. + Accuracy: quota information is distributed throughout the file + system and can only be accurately calculated with a quiescent file + system. @@ -91,90 +91,70 @@ quite file system. lctl get_param version to identify you are currently using. -
- Enabling Disk Quotas (Lustre Software Prior to Release 2.4) - - - For Lustre software releases older than release 2.4, - lfs quotacheck must be first run from a client node to - create quota files on the Lustre targets (i.e. the MDT and OSTs). - lfs quotacheck requires the file system to be quiescent - (i.e. no modifying operations like write, truncate, create or delete - should run concurrently). Failure to follow this caution may result in - inaccurate user/group disk usage. Operations that do not change Lustre - files (such as read or mount) are okay to run. - lfs quotacheck performs a scan on all the Lustre - targets to calculates the block/inode usage for each user/group. If the - Lustre file system has many files, - quotacheck may take a long time to complete. Several - options can be passed to - lfs quotacheck: - -# lfs quotacheck -ug /mnt/testfs - - - - - u-- checks the user disk quota information - - - - g-- checks the group disk quota information - - - By default, quota is turned on after - quotacheck completes. However, this setting isn't - persistent and quota will have to be enabled again (via - lfs quotaon) if one of the Lustre targets is - restarted. - lfs quotaoff is used to turn off quota. - To enable quota permanently with a Lustre software release older - than release 2.4, the - quota_type parameter must be used. This requires - setting - mdd.quota_type and - ost.quota_type, respectively, on the MDT and OSTs. - quota_type can be set to the string - u (user), - g (group) or - ug for both users and groups. This parameter can be - specified at - mkfs time ( - mkfs.lustre --param mdd.quota_type=ug) or with - tunefs.lustre. As an example: - -tunefs.lustre --param ost.quota_type=ug $ost_dev - - When using - mkfs.lustre --param mdd.quota_type=ug or - tunefs.lustre --param ost.quota_type=ug, be sure to - run the command on all OSTs and the MDT. Otherwise, abnormal results may - occur. - - - In Lustre software releases before 2.4, when new OSTs are - added to the file system, quotas are not automatically propagated to - the new OSTs. As a workaround, clear and then reset quotas for each - user or group using the - lfs setquota command. In the example below, quotas - are cleared and reset for user - bob on file system - testfs: - -$ lfs setquota -u bob -b 0 -B 0 -i 0 -I 0 /mnt/testfs -$ lfs setquota -u bob -b 307200 -B 309200 -i 10000 -I 11000 /mnt/testfs - - -
-
+
Enabling Disk Quotas (Lustre Software Release 2.4 and later) - Quota setup is orchestrated by the MGS and all setup - commands in this section must be run on the MGS. Once setup, - verification of the quota state must be performed on the MDT. Although - quota enforcement is managed by the Lustre software, each OSD - implementation relies on the back-end file system to maintain - per-user/group block and inode usage. Hence, differences exist + + Quota setup is orchestrated by the MGS and all setup + commands in this section must be run directly on the MGS. + Support for project quotas specifically requires Lustre Release 2.10 or + later. A patched server may be required, depending + on the kernel version and backend filesystem type: + + + + + + + + + Configuration + + + + + Patched Server Required? + + + + + + + + ldiskfs with kernel version < 4.5 + + Yes + + + + ldiskfs with kernel version >= 4.5 + + No + + + + zfs version >=0.8 with kernel + version < 4.5 + + Yes + + + + zfs version >=0.8 with kernel + version > 4.5 + + No + + + + + *Note: Project quotas are not supported on zfs versions earlier + than 0.8. + + Once setup, verification of the quota state must be performed on the + MDT. Although quota enforcement is managed by the Lustre software, each + OSD implementation relies on the back-end file system to maintain + per-user/group/project block and inode usage. Hence, differences exist when setting up quotas with ldiskfs or ZFS back-ends: @@ -182,13 +162,19 @@ $ lfs setquota -u bob -b 307200 -B 309200 -i 10000 -I 11000 /mnt/testfs mkfs.lustre now creates empty quota files and enables the QUOTA feature flag in the superblock which turns quota accounting on at mount time automatically. e2fsck was also modified - to fix the quota files when the QUOTA feature flag is present. + to fix the quota files when the QUOTA feature flag is present. The + project quota feature is disabled by default, and + tune2fs needs to be run to enable every target + manually. - For ZFS backend, accounting ZAPs are created and maintained by - the ZFS file system itself. While ZFS tracks per-user and group block - usage, it does not handle inode accounting. The ZFS OSD implements - its own support for inode tracking. Two options are available: + For ZFS backend, the project quota feature is not + supported on zfs versions less than 0.8.0. Accounting ZAPs + are created and maintained by the ZFS file system itself. While ZFS + tracks per-user and group block usage, it does not handle inode + accounting for ZFS versions prior to zfs-0.7.0. The ZFS OSD previously + implemented its own support for inode tracking. Two options are + available: The ZFS OSD can estimate the number of inodes in-use based @@ -196,7 +182,8 @@ $ lfs setquota -u bob -b 307200 -B 309200 -i 10000 -I 11000 /mnt/testfs can be enabled by running the following command on the server running the target: lctl set_param - osd-zfs.${FSNAME}-${TARGETNAME}.quota_iused_estimate=1. + osd-zfs.${FSNAME}-${TARGETNAME}.quota_iused_estimate=1. + Similarly to block accounting, dedicated ZAPs are also @@ -214,17 +201,25 @@ $ lfs setquota -u bob -b 307200 -B 309200 -i 10000 -I 11000 /mnt/testfs tunefs.lustre --quota is run against all targets. This command sets the QUOTA feature flag in the superblock and runs e2fsck (as a result, the target must be offline) to build the per-UID/GID disk usage - database. See for further - important considerations. + database. + Lustre filesystems formatted with a Lustre release + prior to 2.10 can be still safely upgraded to release 2.10, but will not + have project quota usage reporting functional until + tune2fs -O project is run against all ldiskfs backend + targets. This command sets the PROJECT feature flag in the superblock and + runs e2fsck (as a result, the target must be offline). See + for further important + considerations. Lustre software release 2.4 and later requires a version of - e2fsprogs that supports quota (i.e. newer or equal to 1.42.3.wc1) to be - installed on the server nodes using ldiskfs backend (e2fsprogs is not - needed with ZFS backend). In general, we recommend to use the latest - e2fsprogs version available on - - http://downloads.hpdd.intel.com/public/e2fsprogs/. + e2fsprogs that supports quota (i.e. newer or equal to 1.42.13.wc5, + 1.42.13.wc6 or newer is needed for project quota support) to be + installed on the server nodes using ldiskfs backend (e2fsprogs is not + needed with ZFS backend). In general, we recommend to use the latest + e2fsprogs version available on + + http://downloads.whamcloud.com/public/e2fsprogs/. The ldiskfs OSD relies on the standard Linux quota to maintain accounting information on disk. As a consequence, the Linux kernel running on the Lustre servers using ldiskfs backend must have @@ -243,7 +238,7 @@ $ lfs setquota -u bob -b 307200 -B 309200 -i 10000 -I 11000 /mnt/testfs lctl conf_param on the MGS via the following syntax: -lctl conf_param fsname.quota.ost|mdt=u|g|ug|none +lctl conf_param fsname.quota.ost|mdt=u|g|p|ugp|none @@ -268,32 +263,38 @@ lctl conf_param fsname.quota.ost|mdt - ug -- to enable quota enforcement for both users - and groups + p -- to enable quota enforcement for projects + only - none -- to disable quota enforcement for both users - and groups + ugp -- to enable quota enforcement for all users, + groups and projects + + + + none -- to disable quota enforcement for all users, + groups and projects Examples: - To turn on user and group quotas for block only on file system + To turn on user, group, and project quotas for block only on + file system testfs1, on the MGS run: - $ lctl conf_param testfs1.quota.ost=ug + $ lctl conf_param testfs1.quota.ost=ugp To turn on group quotas for inodes on file system testfs2, on the MGS run: $ lctl conf_param testfs2.quota.mdt=g - To turn off user and group quotas for both inode and block on file - system + To turn off user, group, and project quotas for both inode and block + on file system testfs3, on the MGS run: $ lctl conf_param testfs3.quota.ost=none $ lctl conf_param testfs3.quota.mdt=none -
+
<indexterm> <primary>Quotas</primary> @@ -325,13 +326,13 @@ group uptodate: glb[1],slv[1],reint[0] <secondary>creating</secondary> </indexterm>Quota Administration Once the file system is up and running, quota limits on blocks - and inodes can be set for both user and group. This is - controlled entirely from a client via three quota + and inodes can be set for user, group, and project. This is + controlled entirely from a client via three quota parameters: Grace period-- The period of time (in seconds) within which users are allowed to exceed their soft limit. There - are four types of grace periods: + are six types of grace periods: user block soft limit @@ -345,18 +346,24 @@ group uptodate: glb[1],slv[1],reint[0] group inode soft limit + + project block soft limit + + + project inode soft limit + The grace period applies to all users. The user block soft limit is for all users who are using a blocks quota. Soft limit -- The grace timer is started - once the soft limit is exceeded. At this point, the user/group can still - allocate block/inode. When the grace time expires and if the user is still - above the soft limit, the soft limit becomes a hard limit and the - user/group can't allocate any new block/inode any more. The user/group - should then delete files to be under the soft limit. The soft limit MUST be - smaller than the hard limit. If the soft limit is not needed, it should be - set to zero (0). + once the soft limit is exceeded. At this point, the user/group/project + can still allocate block/inode. When the grace time expires and if the + user is still above the soft limit, the soft limit becomes a hard limit + and the user/group/project can't allocate any new block/inode any more. + The user/group/project should then delete files to be under the soft limit. + The soft limit MUST be smaller than the hard limit. If the soft limit is + not needed, it should be set to zero (0). Hard limit -- Block or inode allocation will fail with @@ -383,9 +390,9 @@ group uptodate: glb[1],slv[1],reint[0] Usage: -lfs quota [-q] [-v] [-h] [-o obd_uuid] [-u|-g uname|uid|gname|gid] /mount_point -lfs quota -t -u|-g /mount_point -lfs setquota -u|--user|-g|--group username|groupname [-b block-softlimit] \ +lfs quota [-q] [-v] [-h] [-o obd_uuid] [-u|-g|-p uname|uid|gname|gid|projid] /mount_point +lfs quota -t {-u|-g|-p} /mount_point +lfs setquota {-u|--user|-g|--group|-p|--project} username|groupname [-b block-softlimit] \ [-B block_hardlimit] [-i inode_softlimit] \ [-I inode_hardlimit] /mount_point @@ -405,11 +412,28 @@ $ lfs quota -u bob /mnt/testfs $ lfs quota -u bob -v /mnt/testfs + To display general quota information for a specific project (" + 1" in this example), run: + +$ lfs quota -p 1 /mnt/testfs + To display general quota information for a specific group (" eng" in this example), run: $ lfs quota -g eng /mnt/testfs + To limit quota usage for a specific project ID on a specific + directory ("/mnt/testfs/dir" in this example), run: + +$ chattr +P /mnt/testfs/dir +$ chattr -p 1 /mnt/testfs/dir +$ lfs setquota -p 1 -b 307200 -B 309200 -i 10000 -I 11000 /mnt/testfs + + Please note that if it is desired to have + lfs quota -p show the space/inode usage under the + directory properly (much faster than du), then the + user/admin needs to use different project IDs for different directories. + To display block and inode grace times for user quotas, run: $ lfs quota -t -u /mnt/testfs @@ -441,8 +465,9 @@ Total allocated inode limit: 2560, total allocated block limit: 24576 Global quota limits are stored in dedicated index files (there is one such index per quota type) on the quota master target (aka QMT). The QMT - runs on MDT0000 and exports the global indexes via /proc. The global - indexes can thus be dumped via the following command: + runs on MDT0000 and exports the global indices via lctl + get_param. The global indices can thus be dumped via the + following command: # lctl get_param qmt.testfs-QMT0000.*.glb-* The format of global indexes depends on the OSD type. The ldiskfs OSD @@ -455,8 +480,7 @@ uses an IAM files while the ZFS OSD creates dedicated ZAPs. slave is disconnected, the index version is used to determine whether the slave copy of the global index isn't up to date any more. If so, the slave fetches the whole index again and updates the local copy. The slave copy of - the global index is also exported via /proc and can be accessed via the - following command: + the global index can also be accessed via the following command: lctl get_param osd-*.*.quota_slave.limit* @@ -486,7 +510,7 @@ lctl get_param osd-*.*.quota_slave.limit* (aka QSD) which connects to the QMT to allocate/release quota space. The QSD is setup directly from the OSD layer. To reduce quota requests, quota space is initially allocated to QSDs - in very large chunks. How much unused quota space can be hold by a target + in very large chunks. How much unused quota space can be held by a target is controlled by the qunit size. When quota space for a given ID is close to exhaustion on the QMT, the qunit size is reduced and QSDs are notified of the new qunit size value via a glimpse callback. Slaves are then @@ -538,7 +562,7 @@ $ cp: writing `/mnt/testfs/foo`: Disk quota exceeded. lctl get_param *.*.filestotal). For more information on using the lfs df -i command and the command output, see - . + . Unfortunately, the statfs interface does not report the free inode count directly, but instead reports the total inode and used inode counts. The @@ -586,6 +610,14 @@ $ cp: writing `/mnt/testfs/foo`: Disk quota exceeded. Release 2.1 clients newer or equal to release 2.1.4 + To use the project quota functionality introduced in + Lustre 2.10, all Lustre servers and clients must be + upgraded to Lustre release 2.10 or later for project quota to work + correctly. Otherwise, project quota will be inaccessible on + clients and not be accounted for on OSTs. Furthermore, the + servers may be required to use a patched kernel, + for more information see + .