Sun Microsystems
Products & Services
 
Support & Training
 
 

Previous Previous     Contents     Next Next

5.5.1.2 Legacy Mount Points

Filesystems can be managed via legacy tools by setting the mountpoint property to legacy. Legacy filesystems must be managed through the mount and umount commands and the /etc/vfstab file. ZFS does not automatically mount legacy filesystems on boot, and the ZFS mount and umount command do not operate on datasets of this type. The examples below show how to set up and manage a ZFS dataset in legacy mode.

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

In particular, if you have set up separate ZFS /usr or /var file systems, you will need to indicate that they are legacy file systems and you must mount them by creating entries in the /etc/vfstab file. Otherwise, the system/filesystem/local service enters maintenance mode when the system boots.

To automatically mount a legacy filesystem on boot, an entry to the /etc/vfstab file must be added. 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/eschrock -		/mnt		   zfs		-		yes		-	

Note that the device to fsck and fsck pass entries are set to -. This is because the fsck(1M) command is not applicable to ZFS filesystems. See 1.1.2 Transactional Semantics for more information regarding data integrity and the lack of need for fsck in ZFS.

5.5.2 Mounting File Systems

ZFS automatically mounts filesystems on create or boot. Use of the zfs mount subcommand is only necessary when changing mount options or explicitly mounting or unmounting filesystems.

The zfs mount command with no arguments shows all currently mounted filesystems that are managed by ZFS. Legacy managed mount points are not displayed.

# zfs mount
tank                            /tank
tank/home                       /tank/home
tank/home/bonwick               /tank/home/bonwick
tank/ws                         /tank/ws

The -a option can be used to mount all ZFS managed filesystems. Legacy managed filesystems are not mounted.

# zfs mount -a

By default, ZFS does not allow mounting on top of a non-empty directory. To force a mount on top of a non-empty directory, the -O option must be used.

# zfs mount tank/home/alt
cannot mount '/export/home/alt': directory is not empty
use legacy mountpoint to allow this behavior, or use the -O flag
# zfs mount -O tank/home/alt

Legacy mount points must be managed through legacy tools. An attempt to use ZFS tools result in an error.

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

When a filesystem 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:

Property

Mount Options

devices

devices/nodevices

exec

exec/noexec

readonly

ro/rw

setuid

setuid/nosetuid

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

5.5.3 Temporary Mount Properties

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

The following example temporarily sets the read-only option on tank/home/perrin.

# zfs mount -o ro tank/home/perrin

The above example assumes that the filesystem is unmounted. To temporarily change a property on a filesystem that is currently mounted, the special remount option must be used. The following example temporarily changes the atime property to off for a filesystem that is currently mounted.

# zfs mount -o remount,noatime tank/home/perrin
# zfs get atime tank/home/perrin
NAME             PROPERTY      VALUE                      SOURCE
tank/home/perrin atime         off                        temporary

5.5.4 Unmounting File Systems

Filesystems can be unmounted by using the zfs unmount subcommand. The unmount command can take either the mount point or the filesystem name.

Unmounting by filesystem name.

# zfs unmount tank/home/tabriz

Unmounting by mount point.

# zfs unmount /export/home/tabriz

The unmount command fails if the filesystem is active or busy. To forceably unmount a filesystem, the -f option can be used. Care should be taken when forceably unmounting a filesystem, if its contents are actively being used, unpredictable application behavior can result.

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

To provide for backwards compatibility, the legacy umount(1M) command can be used to unmount ZFS filesystems.

# umount /export/home/bob

5.5.5 Sharing ZFS File Systems

Like mountpoints, ZFS can automatically share filesystems through the use of the sharenfs property. Using this method, the administrator does not have to modify the /etc/dfs/dfstab file when a new filesystem is added. The sharenfs property is a comma-separated list of options to pass to the share(1M) command. The special value on is an alias for the default share options, which are read/write permissions for anyone. The special value off indicates that the filesystem is not managed by ZFS, and can be shared through traditional means such as the /etc/dfs/dfstab file. All filesystems whose sharenfs property is not off are shared during boot.

5.5.5.1 Controlling Share Semantics

By default, all filesystems are unshared. To share a new filesystem, run the following command:

# zfs set sharenfs=on tank/home/eschrock

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

# zfs set sharenfs=on tank/home
# zfs create tank/home/bricker
# zfs create tank/home/tabriz
# zfs set sharenfs=ro tank/home/tabriz

Both tank/home/briker and tank/home/tabriz are initially shared writable since they inherit the sharenfs property from tank/home. Once the property is set to ro (readonly), tank/home/tabriz is shared readonly regardless of the sharenfs property set for tank/home.

5.5.5.2 Unsharing Filesystems

While most filesystems are automatically shared and unshared during boot, creation, and destruction, there are times when filesystems need to be explicitly unshared. To do this, use the zfs unshare command:

# zfs unshare tank/home/tabriz

This command unshares the tank/home/tabriz filesystem. To unshare all ZFS filesystems on the system, run:

# zfs unshare -a

5.5.5.3 Sharing Filesystems

As mentioned in the previous section, most of the time the automatic behavior of ZFS (sharing on boot and creation) should be sufficient for normal operation. If, for some reason, you unshare a filesystem, you can share it again with the zfs share command:

# zfs share tank/home/tabriz

You can also share all ZFS filesystems on the system:

# zfs share -a

5.5.5.4 Legacy Shares

If the sharenfs property is off, then ZFS does not attempt to share or unshare the filesystem at any time. This allows the filesystem to be administered through traditional means such as the /etc/dfs/dfstab file.

Unlike the traditional mount command, the traditional share and unshare commands can still function on ZFS filesystems. This means that it's possible to manually share a filesystem with options that are different from those of the sharenfs property. This administrative model is discouraged. You should choose to either manage NFS shares 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, but there are some cases where you may still want to control shares through the familiar model.

5.6 Quotas and Reservations

ZFS supports quotas and reservations at the filesystem level. Filesystem properties provide the ability to set a limit on the amount of space a filesystem can use by setting the quota property as well as the ability to guarantee some amount of space is available to a filesystem by setting the reservation property. Both of these properties apply to the dataset they are set on and all descendants of that dataset.

That is, if a quota is set on tank/home dataset, the total space used by tank/home and all of its descendants cannot exceed the quota. Similarly, if tank/home is given a reservation, tank/home and all of its descendants draw from that reservation. The amount of space used by a dataset (and all of its descendents) is reported by the used property.

Previous Previous     Contents     Next Next