inodes

[cPanel Only]

LVE Manager inodes limits extension allows setting inode limits for the customers. An inode is a data structure on a file system used to keep information about a file or a folder. The number of inodes indicates the number of files and folders an account has. inodes limits work on the level of disk quota , and will be enabled on /home partition only.

LVE Manager allows to set soft and hard IO limit.

  • Hard limit prevents a user from writing data to disk.

  • Soft limit can be exceeded for a period of time. The grace period can be set using: edquota -t .

  • You can set inodes limits using LVE Manager , the same way you would set any other LVE Limits:

Note

We do not collect statistical information on the inodes like we do for other LVE limits.

The limits can be set on the level of individual account or package:

Sometimes disk quota breaks, so do inodes limits. You can reset them through the Options tab of LVE Manager :

The same can be achieved using cloudlinux-config CLI utility

End users can monitor their inodes usage through cPanel:

End user can also see the usage inside resource usage menu.

cl-quota

cl-quota utility is designed to control disk quotas and provides:

  • Setting user and package limits.

  • Integration with panel packages.

  • Limits synchronization.

  • Automatic inheritance of panel limits to all appropriate users.

Note

cl-quota works only with inodes soft/hard limits (soft/hard file limits in setquota/repquota utilities terminology). Block limits are not controlled by cl-quota utility in any way, they are not taken into account and do not affect the data that they issue. That is why hereinafter it is the inode limits that are implied by the word “limits”.

General Provisions

Setting Limits and Integration with Panel Packages

Limits Inheritance

Caching and Synchronizing the Limits

Quotas DB File

CLI Options/Examples

General Provisions

cl-quota utility never sets/reads limits directly in the system, it uses standard setquota/repquota utilities included into the quota package for this purpose.

cl-quota will not work in the following cases:

  • setquota/repquota are missing or working incorrectly;

  • the quotas are not configured in the system.

cl-quota only performs the minimal diagnostics of quota related errors:

  • verifies the availability of setquota/repquota utilities on the disk;

  • verifies if quotas are activated for a specified user (with a separate command), see below.

quota package which contains the required setquota/repquota utilities, is not included in lvemanager package dependencies by default, and quotas activation is a long process which sometimes depends on the panel used, therefore, all the steps on quotas configuration and activation must be carried out by yourself, cl-quota does not perform these actions.

Error messages sent back to the console are extremely rare, to receive error messages use the command:

# cat /var/log/messages | grep clquota

Note

You should not set soft limit higher than hard limit. cl-quota does not control it in any way, but in some cases, the system can ban such limits combination and they won’t be set or will be set in some other way.

Setting Limits and Integration with Panel Packages

cl-quota utility allows setting inodes limits for users of the system.

cl-quota integrates with the panels through a standard mechanism - Integrating LVE Limits with Packages .

Panel users are such users whose UIDs are issued by the above panel integration mechanism. The list of panel packages and the information on the user's affiliation to a particular package is obtained from there as well.

When installing/reading the limits, the following peculiarities are applied:

  1. When displaying quotas, cl-quota displays information about the limits of all users - system and panel. No filter applied. The actual limit values are always displayed.

  2. Limit value -1 for the packages (see below) is displayed as dash (-).

  3. If cl-quota is running under root , it will display the limits returned by repquota utility with no changes. If it is running under some other user, it will return data from a special cache file, see Quotas cache and synchronization” .

  4. Limits setting only works for panel users, for all other users limits are not set (the command is ignored). The only exception - uid=0 . The limits are never set for the root user (uid=0) , but they are stored in DB file and are used by inheritance mechanism. See "Limits Inheritance” .

  5. Hard and soft limits are completely independent, сl-quota does not apply any interdependencies to them. Setting only one of them (any) is acceptable, the other one will not change.

cl-quota utility also supports package limits set/read. When setting package limits, they are set for all users of a particular package except for those whose limits are set individually. See also “Limits Inheritance” .

If package name is "default" , then setting limits command is ignored. If some limits are set for this package in DB file, they will be displayed along with all the others, but will not be used. See also “Limits inheritance” .

Any positive numbers are allowed as limit values. cl-quota neither controls nor changes these values except the following cases:

negative values are taken modulo;

fractional values are converted to integers by discarding the fractional part;

if the transferred value can not be turned into a number (for example, 67wg76), it is completely ignored and the limit is not set at all.

Then these values are transmitted directly to setquota system utility for the actual setting of the limits.

Thus cl-quota has two limit values, which are processed in a special way:

  • 0: Means inheritance of the limit from the package where the user is located, or from uid=0 . See also “Limits inheritance” for more detailed information.

  • -1: The real limits are set to 0, which means no limits, literally "unlimited". This is legit both for individual and for package limits. Limit value -1 is stored in the database as well as any other but is never displayed.

You can use the words “default” and “unlimited” instead of 0 and -1 respectively, they are fully interchangeable. See also “DB File” and “CLI Options” .

Individual and package limits are always saved in DB file. Limits from there are used when synchronizing quotas . Please find more details in “Limits Synchronization” .

Also, find detailed information on DB file itself in Quotas DB File” section.

Utility options are described in “CLI Options” section.

Limits Inheritance

When setting package limits to the package users, the inheritance principle is applied. It means that:

  • If no individual limit is set to a user, then he inherits the limits of the package he belongs to.

  • If no limit is set to a package (=0), then the users inherit uid=0 limits.

Limits of the package named “default” (if found in the DB file) will always be ignored and all the users of this package will get uid=0 limits.

Caching and Synchronizing the Limits

Any user of the system (including panel users) is always created with limits equal to 0. To assign him the limits of the corresponding package, the synchronization process is used.

During the synchronization, cl-quota utility reads the database file and sets the limits from it to the users and packages specified therein. This mode is designed to set the correct limits for the new users and to restore them for the existing ones. When recovering, the current limits are neither read nor analyzed.

Caching - is writing current limits to /etc/container/cl-quotas.cache file. If cl-quota is not started from the root for reading the current limits, then it returns data from this file.

When installing LVE Manager package, a special cron job is installed, which performs synchronization and caching ( cl-quota -YC ) every 5 minutes. Therefore, the correct limits will be set for the user within 5 minutes from the moment of its creation.

Caching and synchronization can also be performed separately, see "CLI Options" section.

To disable this feature add to the config file /etc/sysconfig/cloudlinux .

Quotas DB File

All cl-quota limits settings are stored in along with the UID or the name of the package the limit was set for.

When saving the limits to a file, the following rules are applied:

  • If a limit value is non-integer or non-numeric, then the rules from "Setting limits and integrating with panel packages" section are applied. The assigned value is saved to the file.

  • Limits are always saved in pairs, no matter if only one limit was set or both. The pair looks as follows: soft_limit:hard_limit .

  • The values 0 and -1, when having a predetermined meaning, are saved as is without any transformations.

  • The words “default” and “unlimited” are saved as 0 and -1 respectively.

  • If both limits for a user/package were set as 0, then such user/package is not saved in the file, and if it was previously there - it will be removed. Therefore, if a user/package is not mentioned in the file, then all its limits are inherited. See "Limits Inheritance" section.

The lists of panel users, packages, and user-package correspondence are not saved anywhere, this information is always subtracted from the panel.

Example:

/etc/container/cl-quotas.dat
[users]
0 = 1000:2000
500 = -1:-1
958 = 0:20000
[packages]
pack1 = 5000:-1
It follows that:
  • uid=0 limits are set to 1000:2000 - all users in the default package will obtain these limits.

  • Both limits are set as unlimited for a user with uid=500, which means that its real limits will always be 0:0. The package limits do not affect this user.

  • Soft limit of the user with uid=958 is inherited (0 means inheritance), his hard limit is set to 20000 and it will not depend on the package limits or uid=0 limits.

  • Limits 5000:-1 are set for pack1 package, therefore its real limits are: soft_limit=5000 and hard_limit=0 (unlimited).

  • The users of pack1 package will get pack1 limits (5000:-1), the users of all the rest of the packages will get the limits of uid=0 because no limits are set for them. Exceptions: uid=500 and 958. uid=500 has both limits set individually, and uid=958 inherits only soft limits.

CLI Options/Examples

cl-quotа utility has the following command line options:

-u | --user                  : specifies the user
-U | --user-id              : specifies the user ID
-S | --soft-limit            : sets the soft limit for a user. Pass 0 or 'default' to set package default limit. Pass -1 or 'unlimited' to cancel limit
-H | --hard-limit            : sets the hard limit for a user. Pass 0 or 'default' to set package default limit. Pass -1 or 'unlimited' to cancel limit
-V | --csv                  : returns data as comma separated values
-p | --package              : specifies a package to set or get limits
-P | --package-limits        : prints package limits
-a | --all-package-limits : prints all package limits (including packages without limits)
-Y | --sync                  : synchronizes packages and users limits with the database
-C | --cache-content        : cache quota data to a file the database
-F | --force                : save user quotas even when they are equal to defaults
       --check                : check if quotas is enabled/activated/suported; if disabled show diagnostic information; using with --user or --user-id options

--user and --user-id options are designed to specify user whose limits are required to be set or displayed. --user specifies user name, --user-id - uid . It is acceptable to specify one or another.

--package - specifies package name.

--soft-limit , --hard-limit - specify soft and hard limits values respectively. It is acceptable to use words “default” or “unlimited” as limit value.

--csv - displays limits in csv format (instead of data formatted in the table).

--package-limits - displaying the limits of the packages created by the panel admin.

--all-package-limits - displaying the limits of all the packages, including the ones created by the resellers and packages with no users.

--sync - synchronizes users quotas and packages with the database.

--cache-contents - performs quotas caching.

--force - saving user quotas even if they are equal to the current.

--check - performs diagnostics for a specified user. Can be used only when a user is specified (along with --user / --user-id ).

Examples:

  1. Reading current user limits:
# cl-quota
# cl-quota --csv
  1. Reading current package limits:
# cl-quota --package-limits
# cl-quota --all-package-limits
# cl-quota --package-limits --csv
# cl-quota --all-package-limits --csv
  1. Specifying limits for a user:
# cl-quota --user-id=500 --soft-limit=0 --hard-limit=0
# cl-quota --user-id=500 --soft-limit=unlimited
# cl-quota --user-id=500 --soft-limit=0 --hard-limit=-1
# cl-quota --user-id=958 --hard-limit=20000 --soft-limit=0 --force
  1. Specifying limits for a package:
# cl-quota --package pack1 --hard-limit=-1 --soft-limit=5000
# cl-quota --package pack1 --hard-limit=10000
# cl-quota --package pack1 --soft-limit=default
  1. User diagnostics (with example output):
# cl-quota --user-id=500 --check
Quota disabled for user id 500 (home directory /home/cltest1); quotaon: Mountpoint (or device) / not found or has no quota enabled.
  1. Synchronizing quotas with caching (executed in cron):
# cl-quota -YC