Go to main content

Oracle® ZFS Storage Appliance RESTful API Guide, Release OS8.7.x

Exit Print View

Updated: December 2017
 
 

Filesystem Operations

Filesystem operations list and manage filesystem shares. All commands are scoped to a given storage pool or project.

{service_uri}/pools/{pool}/project/{project}
Table 70  Filesystem Commands
Request
Path /api/storage/v1
Description
GET
/filesystems
List all filesystems
GET
/pools/<pool>/projects /<project>/filesystems
List filesystems
GET
/pools/<pool>/projects /<project>/filesystems?snaps=true
List all filesystems, including snapshots
GET
/pools/<pool>/projects /<project>/filesystems /<filesystem>
Get filesystem details
POST
/pools/<pool>/projects /<project>/filesystems
Create a filesystem
PUT
/pools/<pool>/projects /<project>/filesystems /<filesystem>
Modify a filesystem
DELETE
/pools/<pool>/projects /<project>/filesystems /<filesystem>
Destroy a filesystem
GET
/pools/<pool>/projects /<project>/filesystems /<filesystem>/usage/groups
Get filesystem group usage
GET
/pools/<pool>/projects /<project>/filesystems /<filesystem>/usage/groups /<group>
Get filesystem usage for the specified group
POST
/pools/<pool>/projects /<project>/filesystems /<filesystem>/usage/groups
Create a filesystem group quota
PUT
/pools/<pool>/projects /<project>/filesystems /<filesystem>/usage/groups /<name>
Modify a filesystem group quota
GET
/pools/<pool>/projects /<project>/filesystems /<filesystem>/usage/users
Get filesystem user usage
GET
/pools/<pool>/projects /<project>/filesystems /<filesystem>/usage/users /<user>
Get filesystem usage for the specified user
POST
/pools/<pool>/projects /<project>/filesystems /<filesystem>/usage/users
Create a filesystem user quota
PUT
/pools/<pool>/projects /<project>/filesystems /<filesystem>/usage/users /<name>
Modify a filesystem user quota
GET
/pools/<pool>/projects /<project>/filesystems /<filesystem>/shadow/errors
List Shadow Migration Errors

Each filesystem contains properties from the project and has the following filesystem-specific properties.

Table 71  Filesystem Properties
Type
Name
Description
string
casesensitivity
Case Sensitivity setting ("mixed", “sensitive” or “insensitive”)
string
group
The group name
string
normalization
Normalization
string
permissions
The filesystem permissions
string
project
The project name
boolean
quota_snap
Flag to include snapshots in the quota
boolean
reservation_snap
Flag to include snapshots in the reservation
string
shadow
Data migration source
string
errors
Data migration errors
string
sharesmb_name
Name of SMB share
object
source
Project inheritance properties
object
usage
File system usage information
string
user
The user name that owns the share
boolean
utf8only
Flag to reject non-UTF-8

List Filesystems

The list filesystems command shows all filesystems in a given pool or project.


Note -  The depth query parameter and the match_Property-Name=Value query parameter are not supported.

Query Parameters - filter– A simple string match filter that requires a property within the project to contain the same filter string within its value.

Table 72  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name

Example Request:

GET /api/storage/v1/pools/gold/projects/proj-01/filesystems HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Successful request returns HTTP Status 200 (OK) along with an array of filesystem properties in JSON format.

Example Result:

HTTP/1.1 200 OK
Content-Type: application/json

{
    “filesystems”: [{
        “name”: “filesystem-01”,
        “project”: “proj-01”,
        “pool”: “gold”,
        ...
    }, {
        “name”: “filesystem-02”,
        “project”: “proj-01”,
        “pool”: “gold”,
        ...
    }]
}

A list of all filesystems across all pools and projects is also supported. In that case, the URI would be /api/storage/v1/filesystems.

Example Request (to get all filesystems with the "abcd" string as part of its properties):

GET /api/storage/v1/filesystems?filter=abcd HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Get Filesystem

The get filesystem command returns a single filesystem’s properties in a given pool or project.

Table 73  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name
filesystem
The filesystem name

Example Request (to list project named "proj-01"):

GET /api/storage/v1/pools/gold/projects/proj-01 HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Successful get returns HTTP Status 200 (OK) along with the filesystem properties in JSON format.

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "filesystem": {
        "logbias": "latency",
        "creation": "20130423T21:30:34",
        "nodestroy": false,
        "dedup": false,
        "sharenfs": "on",
        "sharesmb": "off",
        "mountpoint": "/export/grape",
        "snaplabel": "",
        "id": "424ca2ec-b3fa-df86-0000-000000000000",
        "readonly": false,
        "rrsrc_actions": [],
        "compression": "off",
        "sharetftp": "",
        "source": {
            "logbias": "default",
            "dedup": "default",
            "sharenfs": "inherited",
            "sharesmb": "off",
            "mountpoint": "inherited",
            "rrsrc_actions": "local",
            "compression": "default",
            "sharetftp": "inherited",
            "snapdir": "default",
            "aclmode": "default",
            "copies": "default",
            "aclinherit": "default",
            "shareftp": "inherited",
            "readonly": "default",
            "secondarycache": "default",
            "exported": "inherited",
            "vscan": "default",
            "reservation": "local",
            "atime": "default",
            "recordsize": "default",
            "checksum": "inherited",
            "sharesftp": "inherited",
            "nbmand": "default",
            "rstchown": "default"
        },
        "snapdir": "hidden",
        "aclmode": "discard",
        "copies": 1,
        "aclinherit": "restricted",
        "shareftp": "",
        "canonical_name": "platinum/local/default/grape",
        "recordsize": 131072.0,
        "usage": {
            "available": 880395477504.0,
            "loading": false,
            "quota": 0.0,
            "snapshots": 18432.0,
            "compressratio": 100.0,
            "reservation": 0.0,
            "total": 50176.0,
            "data": 31744.0
        },
        "secondarycache": "all",
        "collection": "local",
        "exported": true,
        "vscan": false,
        "reservation": 0.0,
        "shadow": "none",
        "atime": true,
        "pool": "platinum",
        "quota_snap": true,
        "name": "grape",
        "checksum": "fletcher4",
        "project": "default",
        "sharesftp": "",
        "nbmand": false,
        "reservation_snap": true,
        "sharedav": "",
        "rstchown": true,
        "root_acl": {
             "owner@:cC:fd:deny",
             "everyone@:rw:fd:allow",
             "user:john:rw:allow",
        }
        "smbshareacl": {
             "owner@:cC:fd:deny",
             "everyone@:rw:fd:allow",
             "user:john:rw:allow",
        }
}

Create Filesystem

The create filesystem command creates a filesystem with a given name residing in the given storage pool or project. The new filesystem with default properties is returned.

Table 74  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name
filesystem
The filesystem name

Request Parameters:

  • name - The filesystem name must be supplied to create a new filesystem.

  • filesystem properties – Any of the properties listed in filesystem properties or project properties can be set as initial values.

Example Request (to create a filesystem named "share-01" and owned by the user "joe"):

POST /api/storage/v1/pools/gold/projects/proj-01/filesystems HTTP/1.1
Host: zfs-storage.example.com
Content-Type: application/json
Accept: application/json

{
    “name”: “share-01”,
    “root_user”: “joe”
}

Successful creation returns HTTP Status 201 (Created) with the Location header containing the URI of the new filesystem. The body contains all filesystem properties in JSON format.

Example Response:

HTTP/1.1 201 Created
Content-Type: application/json
Location: /api/storage/v1/pools/gold/projects/proj-01/filesystems/share-01

{
    “filesystem”: {
        “name”: “share-01”,
        “pool”: “gold”,
        “collection”: “local”,
        “project”: “proj-01”,
        “root_user”: “joe”
        ...
    }
}

Modify Filesystem

The modify filesystem command changes the attributes of an existing filesystem. Successful response returns HTTP Status 202 (Accepted) and lists all filesystem properties.

Request Parameters - Filesystem Properties – Any of the filesystem or project properties can be modified.

Table 75  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name
filesystem
The filesystem name

Example Request (to change a filesystem name from "share-01" to "new-name" and change the owner to "nobody"):

PUT /api/storage/v1/pools/gold/projects/proj-01/filesystems/share-01
    HTTP/1.1
Host: zfs-storage.example.com
Content-Type: application/json
Accept: application/json

{
    “name”: “new-name”,
    “root_user”: “nobody”,
}

Example Response:

HTTP/1.1 202 Accepted
Content-Type: application/json
Location: http://zfs-storage.example.com:215
          /pools/gold/projects/proj-01/filesystems/share-01

{
    “filesystem”: {
        “name”: “new-name”,
        “pool”: “gold”,
        “collection”: “local”,
        “project”: “proj-01”,
        “root_user”: “nobody”
        ...
    }
}

Delete Filesystem

The delete filesystem command removes a single filesystem in a given pool or project.

Table 76  URI Parameters
Parameter
Description
pool
Storage pool name
project
The project name
filesystem
The filesystem name

To monitor the amount of space to be reclaimed in the storage pool, enter the GET command for pools/<pool>. Note the amount of space for property async_destroy_reclaim_space. When the operation has completed, 0 (zero) is displayed.

Example Request:

DELETE /api/storage/v1/pools/gold/projects/proj-01/filesystems/share-01
       HTTP/1.1
Host: zfs-storage.example.com
Accept: application/json

Successful delete returns HTTP Status 204 (No Content).

Example Response:

HTTP/1.1 204 No-Content

Filesystem Quota and Usage

User or group quotas can be created or modified with POST or PUT requests, respectively. GET requests to filesystem use resources are used to get usage data per user or per group for the project.