JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris ZFS Administration Guide     Oracle Solaris 10 8/11 Information Library
search filter icon
search icon

Document Information


1.  Oracle Solaris ZFS File System (Introduction)

2.  Getting Started With Oracle Solaris ZFS

3.  Oracle Solaris ZFS and Traditional File System Differences

4.  Managing Oracle Solaris ZFS Storage Pools

5.  Installing and Booting an Oracle Solaris ZFS Root File System

6.  Managing Oracle Solaris ZFS File Systems

Managing ZFS File Systems (Overview)

Creating, Destroying, and Renaming ZFS File Systems

Creating a ZFS File System

Destroying a ZFS File System

Renaming a ZFS File System

Introducing ZFS Properties

ZFS Read-Only Native Properties

The used Property

Settable ZFS Native Properties

The canmount Property

The recordsize Property

The volsize Property

ZFS User Properties

Querying ZFS File System Information

Listing Basic ZFS Information

Creating Complex ZFS Queries

Managing ZFS Properties

Setting ZFS Properties

Inheriting ZFS Properties

Querying ZFS Properties

Querying ZFS Properties for Scripting

Mounting and Sharing ZFS File Systems

Managing ZFS Mount Points

Automatic Mount Points

Legacy Mount Points

Mounting ZFS File Systems

Using Temporary Mount Properties

Unmounting ZFS File Systems

Sharing and Unsharing ZFS File Systems

Controlling Share Semantics

Unsharing ZFS File Systems

Sharing ZFS File Systems

Legacy Share Behavior

Setting ZFS Quotas and Reservations

Setting Quotas on ZFS File Systems

Setting User and Group Quotas on a ZFS File System

Setting Reservations on ZFS File Systems

Upgrading ZFS File Systems

7.  Working With Oracle Solaris ZFS Snapshots and Clones

8.  Using ACLs and Attributes to Protect Oracle Solaris ZFS Files

9.  Oracle Solaris ZFS Delegated Administration

10.  Oracle Solaris ZFS Advanced Topics

11.  Oracle Solaris ZFS Troubleshooting and Pool Recovery

12.  Recommended Oracle Solaris ZFS Practices

A.  Oracle Solaris ZFS Version Descriptions


Mounting and Sharing ZFS File Systems

This section describes how ZFS mounts and shares file systems.

Managing ZFS Mount Points

By default, a ZFS file system is automatically mounted when it is created. You can determine specific mount-point behavior for a file system as described in this section.

You can also set the default mount point for a pool's dataset at creation time by using zpool create's -m option. For more information about creating pools, see Creating a ZFS Storage Pool.

All ZFS file systems are mounted by ZFS at boot time by using the Service Management Facility's (SMF) svc://system/filesystem/local service. File systems are mounted under /path, where path is the name of the file system.

You can override the default mount point by using the zfs set command to set the mountpoint property to a specific path. ZFS automatically creates the specified mount point, if needed, and automatically mounts the associated file system.

ZFS file systems are automatically mounted at boot time without requiring you to edit the /etc/vfstab file.

The mountpoint property is inherited. For example, if pool/home has the mountpoint property set to /export/stuff, then pool/home/user inherits /export/stuff/user for its mountpoint property value.

To prevent a file system from being mounted, set the mountpoint property to none. In addition, the canmount property can be used to control whether a file system can be mounted. For more information about the canmount property, see The canmount Property.

File systems can also be explicitly managed through legacy mount interfaces by using zfs set to set the mountpoint property to legacy. Doing so prevents ZFS from automatically mounting and managing a file system. Legacy tools including the mount and umount commands, and the /etc/vfstab file must be used instead. For more information about legacy mounts, see Legacy Mount Points.

Automatic Mount Points

Any dataset whose mountpoint property is not legacy is managed by ZFS. In the following example, a dataset is created whose mount point is automatically managed by ZFS:

# zfs create pool/filesystem
# zfs get mountpoint pool/filesystem
NAME             PROPERTY      VALUE                      SOURCE
pool/filesystem  mountpoint    /pool/filesystem           default
# zfs get mounted pool/filesystem
NAME             PROPERTY      VALUE                      SOURCE
pool/filesystem  mounted       yes                        -

You can also explicitly set the mountpoint property as shown in the following example:

# zfs set mountpoint=/mnt pool/filesystem
# zfs get mountpoint pool/filesystem
NAME             PROPERTY      VALUE                      SOURCE
pool/filesystem  mountpoint    /mnt                       local
# zfs get mounted pool/filesystem
NAME             PROPERTY      VALUE                      SOURCE
pool/filesystem  mounted       yes                        -

When the mountpoint property is changed, the file system is automatically unmounted from the old mount point and remounted to the new mount point. Mount-point directories are created as needed. If ZFS is unable to unmount a file system due to it being active, an error is reported, and a forced manual unmount is necessary.

Legacy Mount Points

You can manage ZFS file systems with legacy tools by setting the mountpoint property to legacy. Legacy file systems must be managed through the mount and umount commands and the /etc/vfstab file. ZFS does not automatically mount legacy file systems at boot time, and the ZFS mount and umount commands do not operate on datasets of this type. The following examples show how to set up and manage a ZFS dataset in legacy mode:

# zfs set mountpoint=legacy tank/home/eric
# mount -F zfs tank/home/eschrock /mnt

To automatically mount a legacy file system at boot time, you must add an entry to the /etc/vfstab file. The following example shows what the entry in the /etc/vfstab file might look like:

#device         device        mount           FS      fsck    mount   mount
#to mount       to fsck       point           type    pass    at boot options

tank/home/eric  -        /mnt           zfs        -        yes        -    

The device to fsck and fsck pass entries are set to - because the fsck command is not applicable to ZFS file systems. For more information about ZFS data integrity, see Transactional Semantics.

Mounting ZFS File Systems

ZFS automatically mounts file systems when file systems are created or when the system boots. Use of the zfs mount command is necessary only when you need to change mount options, or explicitly mount or unmount file systems.

The zfs mount command with no arguments shows all currently mounted file systems that are managed by ZFS. Legacy managed mount points are not displayed. For example:

# zfs mount | grep tank/home
zfs mount | grep tank/home
tank/home                       /tank/home
tank/home/jeff                  /tank/home/jeff

You can use the -a option to mount all ZFS managed file systems. Legacy managed file systems are not mounted. For example:

# zfs mount -a

By default, ZFS does not allow mounting on top of a nonempty directory. For example:

# zfs mount tank/home/lori
cannot mount 'tank/home/lori': filesystem already mounted

Legacy mount points must be managed through legacy tools. An attempt to use ZFS tools results in an error. For example:

# zfs mount tank/home/bill
cannot mount 'tank/home/bill': legacy mountpoint
use mount(1M) to mount this filesystem
# mount -F zfs tank/home/billm

When a file system is mounted, it uses a set of mount options based on the property values associated with the dataset. The correlation between properties and mount options is as follows:

Table 6-4 ZFS Mount-Related Properties and Mount Options

Mount Option

The mount option nosuid is an alias for nodevices,nosetuid.

Using Temporary Mount Properties

If any of the mount options described in the preceding section are set explicitly by using the-o option with the zfs mount command, the associated property value is temporarily overridden. These property values are reported as temporary by the zfs get command and revert back to their original values when the file system is unmounted. If a property value is changed while the dataset is mounted, the change takes effect immediately, overriding any temporary setting.

In the following example, the read-only mount option is temporarily set on the tank/home/perrin file system. The file system is assumed to be unmounted.

# zfs mount -o ro users/home/neil

To temporarily change a property value on a file system that is currently mounted, you must use the special remount option. In the following example, the atime property is temporarily changed to off for a file system that is currently mounted:

# zfs mount -o remount,noatime users/home/neil
users/home/neil  atime     off    temporary
# zfs get atime users/home/perrin

For more information about the zfs mount command, see zfs(1M).

Unmounting ZFS File Systems

You can unmount ZFS file systems by using the zfs unmount subcommand. The unmount command can take either the mount point or the file system name as an argument.

In the following example, a file system is unmounted by its file system name:

# zfs unmount users/home/mark

In the following example, the file system is unmounted by its mount point:

# zfs unmount /users/home/mark

The unmount command fails if the file system is busy. To forcibly unmount a file system, you can use the -f option. Be cautious when forcibly unmounting a file system if its contents are actively being used. Unpredictable application behavior can result.

# zfs unmount tank/home/eric
cannot unmount '/tank/home/eric': Device busy
# zfs unmount -f tank/home/eric

To provide for backward compatibility, the legacy umount command can be used to unmount ZFS file systems. For example:

# umount /tank/home/bob

For more information about the zfs umount command, see zfs(1M).

Sharing and Unsharing ZFS File Systems

ZFS can automatically share file systems by setting the sharenfs property. Using this property, you do not have to modify the /etc/dfs/dfstab file when a new file system is shared. The sharenfs property is a comma-separated list of options to pass to the share command. The value on is an alias for the default share options, which provides read/write permissions to anyone. The value off indicates that the file system is not managed by ZFS and can be shared through traditional means, such as the /etc/dfs/dfstab file. All file systems whose sharenfs property is not off are shared during boot.

Controlling Share Semantics

By default, all file systems are unshared. To share a new file system, use zfs set syntax similar to the following:

# zfs set sharenfs=on tank/home/eric

The sharenfs property is inherited, and file systems are automatically shared on creation if their inherited property is not off. For example:

# zfs set sharenfs=on tank/home
# zfs create tank/home/bill
# zfs create tank/home/mark
# zfs set sharenfs=ro tank/home/bob

Both tank/home/bill and tank/home/mark are initially shared as writable because they inherit the sharenfs property from tank/home. After the property is set to ro (read only), tank/home/mark is shared as read-only regardless of the sharenfs property that is set for tank/home.

Unsharing ZFS File Systems

Although most file systems are automatically shared or unshared during boot, creation, and destruction, file systems sometimes need to be explicitly unshared. To do so, use the zfs unshare command. For example:

# zfs unshare tank/home/mark

This command unshares the tank/home/mark file system. To unshare all ZFS file systems on the system, you need to use the -a option.

# zfs unshare -a

Sharing ZFS File Systems

Most of the time, the automatic behavior of ZFS with respect to sharing file system on boot and creation is sufficient for normal operations. If, for some reason, you unshare a file system, you can share it again by using the zfs share command. For example:

# zfs share tank/home/mark

You can also share all ZFS file systems on the system by using the -a option.

# zfs share -a

Legacy Share Behavior

If the sharenfs property is set to off, then ZFS does not attempt to share or unshare the file system at any time. This value enables you to administer file system sharing through traditional means, such as the /etc/dfs/dfstab file.

Unlike the legacy mount command, the legacy share and unshare commands can still function on ZFS file systems. As a result, you can manually share a file system with options that differ from the options of the sharenfs property. This administrative model is discouraged. Choose to manage NFS shares either completely through ZFS or completely through the /etc/dfs/dfstab file. The ZFS administrative model is designed to be simpler and less work than the traditional model.