zfs.resource.userspace.set

Set or remove the space and object limits of users or groups on a filesystem.

A limit left as null is not changed and a limit of 0 or "none" is removed. Limits are written as the <type>quota@<xid> and <type>objquota@<xid> properties of the filesystem, for example userquota@1000. Read the result back with zfs.resource.userspace.list. Limits on the filesystem itself are set with zfs.resource.set.

A validation error is raised when:

  • a snapshot path is supplied (EINVAL)

  • the path references a protected internal resource (EACCES)

  • the filesystem does not exist (ENOENT)

  • the path is a volume (EINVAL)

  • the filesystem is locked (EACCES)

  • an entry sets neither quota nor objquota (EINVAL)

  • an entry names user or group id 0 (EINVAL)

  • the same type and id are given more than once (EINVAL)

Note

Every check runs before anything is written, but ZFS applies the limits one at a time, so a failure reported by ZFS may leave part of the request applied.

Examples:

Limit a user to 10 GiB and 100000 objects:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "zfs.resource.userspace.set",
    "params": [
        {"path": "tank/home", "quotas": [{"type": "user", "xid": 1000, "quota": "10G", "objquota": 100000}]}
    ]
}

Remove the space limit of a group:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "zfs.resource.userspace.set",
    "params": [{"path": "tank/home", "quotas": [{"type": "group", "xid": 1001, "quota": 0}]}]
}
Type: object

Type: array
No Additional Items

Tuple Validation

Parameter 1: data

data

Type: object

The filesystem and the limits to write to it.

No Additional Properties

Path

Type: string

Path of the filesystem to change. Snapshot paths are not accepted.

Must be at least 1 characters long

Quotas

Type: array of object

Limits to write. Each entry must set quota, objquota or both.

Must contain a minimum of 1 items

No Additional Items
Each item of this array must be:

ZFSResourceUserspaceQuota

Type: object
No Additional Properties

Type

Type: enum (of string)

Whether xid is a user or group id.

Must be one of:
  • "user"
  • "group"

Xid

Type: integer

The numeric user or group id.

Value must be greater or equal to 0 and lesser or equal to 4294967295

Quota

Default: null

Space limit, as a byte count or a size string such as '10G'. 0 or 'none' removes the limit. Null leaves it unchanged.

Type: integer
Type: null

Objquota

Default: null

Object count limit. 0 or 'none' removes the limit. Null leaves it unchanged.

Type: integer
Type: null

Result

Type: null


Required roles: ZFS_RESOURCE_WRITE