Add ZFS file system to Solaris non-global zone

Ever wanted to add a ZFS file system to a Solaris 10 non-global zone but ran into the following error:

could not verify fs /test: zfs 'tank/test' mountpoint is not "legacy"
zoneadm: zone non-global-zone failed to verify

The fix would be to update/create the ZFS dataset as a legacy mount point. For this post, I assume that you have both basic understanding of Solaris zone technology and zfs file systems.

In the version of Solaris that I run, (Solaris 10 11/06, sparc) here are the steps you would need to follow in order to add a ZFS file system to a Solaris non-global zone.

  1. Create a legacy zfs pool from the global zone
    # zpool create tank c0t0d0s0
  2. Create a zfs dataset using the new tank zfs pool
    # zfs create tant/test
  3. Display the zfs pool
    # zfs list
    NAME USED AVAIL REFER MOUNTPOINT
    tank 6.57G 120G 26.5K /tank
    tank/test 24.5K 120G 24.5K /tank/test
  4. Set the new tank/test dataset as a legacy mount point
    # zfs set mountpoint=legacy tank/test
  5. Display the zfs pool
    # zfs list
    NAME USED AVAIL REFER MOUNTPOINT
    tank 6.57G 120G 24.5K /tank
    tank/test 24.5K 120G 24.5K legacy
  6. Create a Solaris non-global zone with similar options as below
    # zonecfg -z non-global-zone info

    ...
    fs:
    dir: /test
    special: tank/test
    raw not specified
    type: zfs
    options: []
    dataset:
    name: tank/test
    ...

After the zone has been created and booted, login into the non-global-zone and running a "df" will show you the new ZFS pool is mounted and ready to satisfy your ZFS needs.