Setting HDFS Quotas

You can set quotas in HDFS for:
  • The number of file and directory names used
  • The amount of space used by given directories
Points to note:
  • The quotas for names and the quotas for space are independent of each other.
  • File and directory creation fails if the creation would cause the quota to be exceeded.
  • Allocation fails if the quota would prevent a full block from being written; keep this in mind if you are using a large block size.
  • If you are using replication, remember that each replica of a block counts against the quota.

Commands

To set space quotas on a directory:
dfsadmin -setSpaceQuota n directory
where n is a number of bytes and directory is the directory the quota applies to. You can specify multiple directories in a single command; napplies to each.
To remove space quotas from a directory:
dfsadmin -clrSpaceQuota directory
You can specify multiple directories in a single command.
To set name quotas on a directory:
dfsadmin -setQuota n directory
where n is the number of file and directory names in directory. You can specify multiple directories in a single command; napplies to each.
To remove name quotas from a directory:
dfsadmin -clrQuota directory
You can specify multiple directories in a single command.

For More Information

For more information, see the HDFS Quotas Guide.