Oracle Solaris 10 ZFS Administration

Menu

Introduction

Getting Started With ZFS

Mastering ZFS Basics

Managing ZFS Storage Pools

Managing ZFS File Systems

Working With ZFS Snapshots and Clones

Installing and Booting a ZFS Root File System

Troubleshooting ZFS Issues and Recovering ZFS Data

ZFS Advanced Topic


Using ACLs to Protect ZFS Files

ZFS Delegated Administration

Managing ZFS File Systems
 
From docs.oracle.com:

Managing ZFS File Systems

ZFS and Traditional File System Differences

Managing ZFS Properties

Mounting and Sharing ZFS File Systems


Bloggers:

Simon.s blog, Home Fileserver: ZFS File Systems

Doug McCallum's Share Manager Weblog SMB vs. ZFS

Jeff Bonwick's Weblog ZFS Block Allocation describes device selection, metaslab selection and block selection on the zfs filesystem.

Jeff Bonwick's Weblog ZFS End-to-End Data Integrity

Bill Moore's Blog Site Flippin' off bits Ditto Blocks - The Amazing Tape Repellent.

Random ramblings of a paranoid git, ZFS the perfect file system for audit trails.

Tim Thomas's Blog, Configuring the OpenSolaris Virus Scanning Services for ZFS Accessed via CIFS and NFSv4 Clients

Lewis Thompson's weblog Introduction to Solaris CIFS & VSCAN (Cardiff presentation)

Blog O. Matty ZFS dataset and volume properties

Jeff Savit's Weblog Deduplication now in ZFS.

Jeff Bonwick's Weblog ZFS Deduplication.

paulie's world in blog form ZFS Encryption for USB sticks on Solaris 11 Express

The Observatory, Quick & Dirty NFS.

Bizarre ! Vous avez dit Bizarre ?, Dedup Performance Considerations

Jeff Bonwick's Blog, ZFS Deduplication

Virtually All The Time, Deduplication now in ZFS

Ben Rockwood, First Look at ZFS Deduplication

The Observatory Quick & Dirty NFS


Other

Sun ZFS Storage Appliance Deduplication Design and Implementation Guidelines

Implementing OpenSolaris' vscan service with ClamAV on ZFS filesystems. John Weekley

ZFS Cheatsheet

ZFS Crypto Cindy Swearingen interviews Darren Moffat about the ZFS Crypto project.

ZFS Crypto: Data Encryption for Local, NAS and SAN Darren Moffat presents at the Solaris Security Summit, November 2009.


Property Changes...

shareiscsi property, starting with the Solaris 10 8/07 release, you can create a ZFS volume as a Solaris iSCSI target device by setting the shareiscsi property on the ZFS volume. This method is a convenient way to quickly set up a Solaris iSCSI target.

chaos:/> zfs create -V 2g tank/volumes/v2
chaos:/> zfs set shareiscsi=on tank/volumes/v2

chaos:/> iscsitadm list target
Target: tank/volumes/v2
     iSCSI Name: iqn.1986-03.com.sun:02:984fe301-c412-ccc1-cc80-cf9a72aa062a
     Connections: 0

ZFS canmount property, starting with the Solaris 10 8/07 release, you use the canmount property to specify whether a dataset can be mounted by using the zfs mount command.

The first example shows a existing directory in /export/home on this system, the canmount property is used to "add" the ZFS home directory file systems to this existing UFS file system.

The existing UFS file system contains a home directory.

chaos:/> ls -F /export/home
tim/

chaos:/> df -h /export/home/tim
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0t0d0s0       13G   5.9G   7.3G    45%    /

The additional home directories are ZFS file systems.

chaos:/> zfs list
...
bpool/users                             102K  5.00G  28.5K  /bpool/users
bpool/users/curly                      24.5K  5.00G  24.5K  /bpool/users/curly
bpool/users/larry                      24.5K  5.00G  24.5K  /bpool/users/larry
bpool/users/moe                        24.5K  5.00G  24.5K  /bpool/users/moe
...

The canmount option is set to "off" and the mountpoint is changed for the ZFS file systems.

chaos:/> zfs set canmount=off bpool/users

chaos:/> zfs set mountpoint=/export/home bpool/users

chaos:/> zfs get mounted bpool/users
NAME         PROPERTY  VALUE        SOURCE
bpool/users  mounted   no           -

chaos:/> zfs get mounted bpool/users/larry
NAME               PROPERTY  VALUE              SOURCE
bpool/users/larry  mounted   yes                -

The result is the home directories are now in the same location although they reside on two seperate file systems.

chaos:/>  ls -F /export/home
curly/  larry/  moe/    tim/

chaos:/> zfs list
...
bpool/users                             102K  5.00G  28.5K  /export/home
bpool/users/curly                      24.5K  5.00G  24.5K  /export/home/curly
bpool/users/larry                      24.5K  5.00G  24.5K  /export/home/larry
bpool/users/moe                        24.5K  5.00G  24.5K  /export/home/moe
...

The next example uses the canmount property to configure to sets of directories under the same mountpoint that can have different ZFS properties set.

chaos:/> zfs create -o mountpoint=/development -o canmount=off bpool/development

chaos:/> zfs create -o mountpoint=/development -o canmount=off bpool/admin

chaos:/> zfs create bpool/development/mernest

chaos:/> zfs create bpool/admin/fsayers

chaos:/> ls -F /development
fsayers/  mernest/

chaos:/> zfs set compression=on bpool/development

chaos:/> zfs get compression bpool/development/mernest
NAME                       PROPERTY     VALUE                      SOURCE
bpool/development/mernest  compression  on                         inherited from bpool/development

chaos:/> zfs get compression bpool/admin/fsayers
NAME                 PROPERTY     VALUE                SOURCE
bpool/admin/fsayers  compression  off                  default

chaos:/> zfs list
NAME                                    USED  AVAIL  REFER  MOUNTPOINT
...
bpool/admin                              49K  11.6G  24.5K  /development
bpool/admin/fsayers                    24.5K  11.6G  24.5K  /development/fsayers ...
bpool/development                        49K  11.6G  24.5K  /development
bpool/development/mernest              24.5K  11.6G  24.5K  /development/mernest
...


ZFS user properties, starting with the Solaris 10 8/07 release, ZFS supports user properties, in addition to the standard native properties that can either export internal statistics or control ZFS file system behavior. User properties have no effect on ZFS behavior, but you can use them to annotate datasets with information that is meaningful in your environment. User property names must contain a colon (":") character, to distinguish them from native properties.

chaos:/> zfs set org.timwort:backup=10/15/08 bpool/users

chaos:/> zfs list -o org.timwort:backup bpool/users
ORG.TIMWORT:BACKUP
10/15/08

chaos:/> zfs get  org.timwort:backup bpool/users
NAME         PROPERTY            VALUE               SOURCE
bpool/users  org.timwort:backup  10/15/08            local

chaos:/> zfs get all bpool/users
NAME         PROPERTY            VALUE                  SOURCE
bpool/users  type                filesystem             -
bpool/users  creation            Fri Sep 19  6:03 2008  -
bpool/users  used                102K                   -
bpool/users  available           5.00G                  -
bpool/users  referenced          28.5K                  -
bpool/users  compressratio       1.00x                  -
bpool/users  mounted             no                     -
bpool/users  quota               5G                     local
bpool/users  reservation         none                   default
bpool/users  recordsize          128K                   default
bpool/users  mountpoint          /export/home           local
bpool/users  sharenfs            on                     local
bpool/users  checksum            on                     default
bpool/users  compression         off                    default
bpool/users  atime               on                     default
bpool/users  devices             on                     default
bpool/users  exec                on                     default
bpool/users  setuid              on                     default
bpool/users  readonly            off                    default
bpool/users  zoned               off                    default
bpool/users  snapdir             hidden                 default
bpool/users  aclmode             groupmask              default
bpool/users  aclinherit          secure                 default
bpool/users  canmount            off                    local
bpool/users  shareiscsi          off                    default
bpool/users  xattr               on                     default
bpool/users  org.timwort:backup  10/15/08               local

The following sequence of commands removes the property from this dataset.

chaos:/> zfs inherit org.timwort:backup bpool/users

chaos:/> zfs list -o  org.timwort:backup bpool/users
ORG.TIMWORT:BACKUP
-

chaos:/> zfs get all bpool/users
NAME         PROPERTY       VALUE                  SOURCE
bpool/users  type           filesystem             -
bpool/users  creation       Fri Sep 19  6:03 2008  -
bpool/users  used           102K                   -
bpool/users  available      5.00G                  -
bpool/users  referenced     28.5K                  -
bpool/users  compressratio  1.00x                  -
bpool/users  mounted        no                     -
bpool/users  quota          5G                     local
bpool/users  reservation    none                   default
bpool/users  recordsize     128K                   default
bpool/users  mountpoint     /export/home           local
bpool/users  sharenfs       on                     local
bpool/users  checksum       on                     default
bpool/users  compression    off                    default
bpool/users  atime          on                     default
bpool/users  devices        on                     default
bpool/users  exec           on                     default
bpool/users  setuid         on                     default
bpool/users  readonly       off                    default
bpool/users  zoned          off                    default
bpool/users  snapdir        hidden                 default
bpool/users  aclmode        groupmask              default
bpool/users  aclinherit     secure                 default
bpool/users  canmount       off                    local
bpool/users  shareiscsi     off                    default
bpool/users  xattr          on                     default
chaos:/>

A ZFS file system automatically stores metadata multiple times across different disks, if possible, as a reliability feature. This feature is known as ditto blocks. Starting with the Solaris 10 10/08 release, you can specify that multiple copies of user data is also stored per file system by using the zfs set copies command. For example:

# zfs set copies=3 bpool/users

# zfs get copies bpool/users
NAME        PROPERTY  VALUE       SOURCE
bpool/users  copies    3           local

The compression property is changed in the Solaris 10 10/08 release to support the gzip compression. The default is lzjb and is designed for peformance.

The property can be set to "on" or "lzjb", the values are equivalent. For gzip the property can be set to "gzip" or "gzip-#" where "#" is a integer from 1 to 9. "gzip" is equivalent to "gzip-6". Integer 1 is the fastest while integer 9 is the highest compression.


Setting ZFS user and group quotas . In previous Solaris releases, you could apply quotas and reservations to ZFS file systems to manage and reserve space. In this Solaris release, you can set a quota on the amount of space consumed by files that are owned by a particular user or group. You might consider setting user and group quotas in an environment with a large number of users or groups. You can set user or group quotas by using the zfs userspace and zfs groupspace properties as follows:


# zfs set userquota@user1=5G tank/data
# zfs set groupquota@staff=10G tank/staff/admins

You can display a user's or group's current quota setting as follows:


# zfs get userquota@user1 tank/data
NAME       PROPERTY         VALUE            SOURCE
tank/data  userquota@user1  5G               local
# zfs get groupquota@staff tank/staff/admins
NAME               PROPERTY          VALUE             SOURCE
tank/staff/admins  groupquota@staff  10G               local

  • ZFS property enhancements . The Solaris 10 10/09 release provides the following ZFS property enhancements:

    • You can set ZFS file system properties at pool creation time. In the following example, compression is enabled on the ZFS file system that is created when the pool is created.


      # zpool create -O compression=on pool mirror c0t1d0 c0t2d0
      
    • You can set two cache properties on a ZFS file system that allow you to control what is cached in the primary cache (ARC) or the secondary cache (L2ARC). The cache properties are set as follows:

      • primarycache . Controls what is cached in the ARC.

      • secondarycache . Controls what is cached in the L2ARC.

      You can set these properties on an existing file system or when the file system is created. For example:


      # zfs set primarycache=metadata tank/datab
      # zfs create -o primarycache=metadata tank/newdatab

      Some database environments might benefit from not caching user data. You will have determine if setting cache properties is appropriate for your environment.

      For more information, see the Solaris ZFS Administration Guide

    • You can use the space usage properties to identify space usage for clones, file systems, and volumes, but not snapshots. The properties are as follows:

      • usedbychildren . Identifies the amount of space that is used by children of this dataset, which would be freed if all the dataset's children were destroyed. The property abbreviation is usedchild.

      • usedbydataset . Identifies the amount of space that is used by this dataset itself, which would be freed if the dataset was destroyed, after first destroying any snapshots and removing any refreservation. The property abbreviation is usedds.

      • usedbyrefreservation . Identifies the amount of space that is used by a refreservation set on this dataset, which would be freed if the refreservation was removed. The property abbreviation is usedrefreserv.

      • usedbysnapshots . Identifies the amount of space that is consumed by snapshots of this dataset. In particular, it is the amount of space that would be freed if all of this dataset's snapshots were destroyed. Note that this is not simply the sum of the snapshots' used properties, because space can be shared by multiple snapshots. The property abbreviation is usedsnap.

      These new properties break down the value of the used property into the various elements that consume space. In particular, the value of the used property breaks down as follows:


      used property = usedbychildren + usedbydataset + 
      usedbyrefreservation + usedbysnapshots

      You can view these properties by using the zfs list -o space command. For example:


      # zfs list -o space
      NAME               AVAIL   USED  USEDSNAP  USEDDS  USEDREFRESERV  USEDCHILD
      pool               33.2G    72K         0     21K              0        51K
      rpool              27.0G  6.27G     20.5K     97K              0      6.27G
      rpool/ROOT         27.0G  4.73G         0     21K              0      4.73G
      rpool/ROOT/zfsBE   27.0G  4.73G     97.5M   4.63G              0          0
      rpool/dump         27.0G  1.00G       16K   1.00G              0          0
      rpool/export       27.0G    60K       16K     23K              0        21K
      rpool/export/home  27.0G    21K         0     21K              0          0
      rpool/swap         27.5G   553M         0   41.5M           512M          0
    • In this release, snapshots are omitted from zfs list output. The listsnaps pool property controls whether snapshot information is displayed by the zfs list command. If you use the zfs list -t snapshots command, snapshot information is displayed. The default value is off, which means snapshot information is not displayed by default.


      Using cache devices in your ZFS storage pool . In the Solaris 10 10/09 release, you can create pool and specify cache devices, which are used to cache storage pool data. Cache devices provide an additional layer of caching between main memory and disk. Using cache devices provide the greatest performance improvement for random read-workloads of mostly static content.

      One or more cache devices can specified when the pool is created. For example:


      # zpool create pool mirror c0t2d0 c0t4d0 cache c0t0d0
      # zpool status pool
        pool: pool
       state: ONLINE
       scrub: none requested
      config:
      
              NAME        STATE     READ WRITE CKSUM
              pool        ONLINE       0     0     0
                mirror    ONLINE       0     0     0
                  c0t2d0  ONLINE       0     0     0
                  c0t4d0  ONLINE       0     0     0
              cache
                c0t0d0    ONLINE       0     0     0
      
      errors: No known data errors

      For information about determining whether using cache devices is appropriate for your environment, see the Solaris ZFS Administration Guide