Go to main content

Managing ZFS File Systems in Oracle® Solaris 11.4

Exit Print View

Updated: February 2021

How to Set Up ZFS on a System

  1. Assume the root role or an equivalent role with the appropriate ZFS rights profile.

    For more information about the ZFS rights profiles, see Hardware and Software Requirements.

  2. Create the ZFS pool.
    $ zpool create pool keyword devices [keyword devices]

    Name of the ZFS pool. The pool name must satisfy the naming requirements in Naming ZFS Components


    Further specifies the pool configuration such as type of redundancy, or whether log devices or cache will be used.

    For the redundancy type, you use either the keyword mirror for a mirrored configuration or one of the following keywords for a RAID-Z configuration, depending on the parity you want: raidz or raidz1 for single parity, raidz2 for double parity, and raidz3 for triple parity.


    Specify the devices that are allocated for the pool. The devices cannot be in use or contain another file system. Otherwise, pool creation fails.

    For more information about how device usage is determined, see Devices Actively Being Used.

  3. (Optional) Display a list of ZFS pools on the system.
    $ zpool list
  4. (Optional) Display the status of the pool.
    $ zpool status pool
  5. Build the file system hierarchy.
    1. Create the basic file system.

      The basic file system acts as a container for the individual file systems that are subsequently created.

      $ zfs create pool/filesystem

      where filesystem is the name of the file system.

      When used in a command, the file system name must always include the full path of the hierarchy: pool/filesystem. This rule also applies to subsequent children file systems that you create.

    2. Set the properties to be shared by children file systems.
      $ zfs set property=value pool/filesystem

      You can set multiple system properties.

      Tip  -  You can simultaneously create a file system and set its properties by using the following syntax:
      $ zfs create -o property=value [-o property=value] pool/filesystem

    3. Create the individual file systems that are grouped under the basic file system.
      $ zfs create pool/filesystem/fs1
      $ zfs create pool/filesystem/fs2

      where fs1, fs2, and so on are individual file systems.

    4. (Optional) Set properties specific to the individual file system.
      $ zfs set property=value pool/filesystem/fs1
  6. (Optional) View the final results.
    $ zpool list

    For more information about viewing pool status, see Querying ZFS Storage Pool Status.

Example 1  Configuring a Mirrored ZFS File System

    In the following example, a basic ZFS configuration is created on the system with the following specifications:

  • Two disks are allocated to the ZFS file system: c1t0d0 and c2t0d0.

  • The pool system1 uses mirroring.

  • The file system home is created over the pool.

  • The following properties are set for home: mountpoint, share.nfs, and compression.

  • Two children file systems, user1 and user2 are created on home.

  • A quota is set for user2. This property restricts the disk space available for user2 regardless of the available disk space of the entire pool.

The command zfs get used example displays file system properties.

$ zpool create system1 mirror c1t0d0 c2t0d0
$ zpool list
system1     80G     137K       80G      0%     ONLINE     -

$ zpool status system1

pool: system1
state: ONLINE
scrub: none requested

system1       ONLINE       0      0      0
   mirror-0   ONLINE       0      0      0
      c1t0d0  ONLINE       0      0      0
      c2t0d0  ONLINE       0      0      0

errors: No known data errors

$ zfs create system1/home
$ zfs set mountpoint=/export/zfs system1/home
$ zfs set share.nfs=on system1/home
$ zfs set compression=on system1/home

$ zfs get compression system1/home
NAME             PROPERTY       VALUE     SOURCE
system1/home     compression    on        local

$ zfs create system1/home/user1
$ zfs create system1/home/user2

$ zfs set quota=10G system1/home/user2

$ zfs list
NAME                      USED  AVAIL  REFER  MOUNTPOINT
system1                  92.0K  67.0G   9.5K  /system1
system1/home             24.0K  67.0G     8K  /export/zfs
system1/home/user1          8K  67.0G     8K  /export/zfs/user1
system1/home/user2          8K  10.0G     8K  /export/zfs/user2
Example 2  Configuring a RAID-Z ZFS File System

This example creates a RAID-Z file system and shows how you can specify disks by using either their shorthand device names or their full device names: the disk c6t0d0 is the same as /dev/dsk/c6t0d0.

  • Three disks are allocated to the ZFS file system: c4t0d0, c5t0d0, and c6t0d0.

  • The pool rdpool uses a RAID-Z single-parity configuration.

  • The file system base is created over the pool.

$ zpool create rdpool raidz c4t0d0 c5t0d0 /dev/dsk/c6t0d0
$ zpool list
rdpool     120G     205K      120G      0%     ONLINE     -

$ zpool status -v rdpool
  pool: rdpool
 state: ONLINE
 scrub: none requested

        NAME        STATE     READ WRITE CKSUM
        rdpool      ONLINE       0     0     0
          raidz-0   ONLINE       0     0     0
            c4t0d0  ONLINE       0     0     0
            c5t0d0  ONLINE       0     0     0
            c6t0d0  ONLINE       0     0     0

errors: No known data errors

$ zfs create rdpool/base
$ zfs set mountpoint=/export/zfs rdpool/base
$ zfs set share.nfs=on rdpool/base
$ zfs set compression=on rdpool/base

$ zfs get compression rdpool/home
NAME               PROPERTY       VALUE     SOURCE
rdpool/base        compression    on        local

$ zfs create rdpool/base/user1
$ zfs create rdpool/base/user2

$ zfs set quota=10G rdpool/base/user2

$ zfs list
rdpool                  92.0K  67.0G   9.5K  /rdpool
rdpool/base             24.0K  67.0G     8K  /export/zfs
rdpool/base/user1          8K  67.0G     8K  /export/zfs/user1
rdpool/base/user2          8K  10.0G     8K  /export/zfs/user2