此内容没有您所选择的语言版本。

Chapter 6. Ceph File System quotas


As a storage administrator, you can view, set, and remove quotas on any directory in the file system. You can place quota restrictions on the number of bytes or the number of files within the directory.

Prerequisites

  • A running, and healthy Red Hat Ceph Storage cluster.
  • Deployment of a Ceph File System.
  • Make sure that the attr package is installed.

6.1. Ceph File System quotas

The Ceph File System (CephFS) quotas allow you to restrict the number of bytes or the number of files stored in the directory structure. Ceph File System quotas are fully supported using a FUSE client or using Kernel clients, version 4.17 or newer.

Limitations

  • CephFS quotas rely on the cooperation of the client mounting the file system to stop writing data when it reaches the configured limit. However, quotas alone cannot prevent an adversarial, untrusted client from filling the file system.
  • Once processes that write data to the file system reach the configured limit, a short period of time elapses between when the amount of data reaches the quota limit, and when the processes stop writing data. The time period generally measures in the tenths of seconds. However, processes continue to write data during that time. The amount of additional data that the processes write depends on the amount of time elapsed before they stop.
  • When using path-based access restrictions, be sure to configure the quota on the directory to which the client is restricted, or to a directory nested beneath it. If the client has restricted access to a specific path based on the MDS capability, and the quota is configured on an ancestor directory that the client cannot access, the client will not enforce the quota. For example, if the client cannot access the /home/ directory and the quota is configured on /home/, the client cannot enforce that quota on the directory /home/user/.
  • Snapshot file data that has been deleted or changed does not count towards the quota.
  • No support for quotas with NFS clients when using setxattr, and no support for file-level quotas on NFS. To use quotas on NFS shares, you can export them using subvolumes and setting the --size option.

6.2. Viewing quotas

Use the getfattr command and the ceph.quota extended attributes to view the quota settings for a directory.

Note

If the attributes appear on a directory inode, then that directory has a configured quota. If the attributes do not appear on the inode, then the directory does not have a quota set, although its parent directory might have a quota configured. If the value of the extended attribute is 0, the quota is not set.

Prerequisites

  • Root-level access to the Ceph client node.
  • The attr package is installed.

Procedure

  1. To view CephFS quotas.

    1. Using a byte-limit quota:

      Syntax

      getfattr -n ceph.quota.max_bytes DIRECTORY
      Copy to Clipboard Toggle word wrap

      Example

      [root@client ~]# getfattr -n ceph.quota.max_bytes /mnt/cephfs/
      getfattr: Removing leading '/' from absolute path names
      # file: mnt/cephfs/
      ceph.quota.max_bytes="100000000"
      Copy to Clipboard Toggle word wrap

      In this example, 100000000 equals 100 MB.

    2. Using a file-limit quota:

      Syntax

      getfattr -n ceph.quota.max_files DIRECTORY
      Copy to Clipboard Toggle word wrap

      Example

      [root@client ~]# getfattr -n ceph.quota.max_files /mnt/cephfs/
      getfattr: Removing leading '/' from absolute path names
      # file: mnt/cephfs/
      ceph.quota.max_files="10000"
      Copy to Clipboard Toggle word wrap

      In this example, 10000 equals 10,000 files.

6.3. Setting quotas

This section describes how to use the setfattr command and the ceph.quota extended attributes to set the quota for a directory.

Prerequisites

  • Root-level access to the Ceph client node.
  • The attr package is installed.

Procedure

  • Set the quota for a direcotry by using a byte-limit quota:

    Note

    The following values are supported for byte-limit quota: K, Ki, M, Mi, G, Gi, T, and Ti.

    Syntax

    setfattr -n ceph.quota.max_bytes -v LIMIT_VALUE DIRECTORY
    Copy to Clipboard Toggle word wrap

    Example

    [root@client ~]# setfattr -n ceph.quota.max_bytes -v 2T /cephfs/
    Copy to Clipboard Toggle word wrap

  • Set the quota for a directory by using a file-limit quota:

    Syntax

    setfattr -n ceph.quota.max_files -v LIMIT_VALUE DIRECTORY
    Copy to Clipboard Toggle word wrap

    Example

    [root@client ~]# setfattr -n ceph.quota.max_files -v 10000 /cephfs/
    Copy to Clipboard Toggle word wrap

    In this example, 10000 equals 10,000 files.

    Note

    Only numerical values are supported for the file LIMIT_VALUE.

6.4. Removing quotas

This section describes how to use the setfattr command and the ceph.quota extended attributes to remove a quota from a directory.

Prerequisites

  • Root-level access to the Ceph client node.
  • Make sure that the attr package is installed.

Procedure

  1. To remove CephFS quotas.

    1. Using a byte-limit quota:

      Syntax

      setfattr -n ceph.quota.max_bytes -v 0 DIRECTORY
      Copy to Clipboard Toggle word wrap

      Example

      [root@client ~]# setfattr -n ceph.quota.max_bytes -v 0 /mnt/cephfs/
      Copy to Clipboard Toggle word wrap

    2. Using a file-limit quota:

      Syntax

      setfattr -n ceph.quota.max_files -v 0 DIRECTORY
      Copy to Clipboard Toggle word wrap

      Example

      [root@client ~]# setfattr -n ceph.quota.max_files -v 0 /mnt/cephfs/
      Copy to Clipboard Toggle word wrap

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部