Zfs on linux mount

Zfs on linux mount

This section describes how mount points and shared file systems are managed in ZFS.

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 when the zfs mount -a command is invoked, 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 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.

Читайте также:  Linux показания датчиков температуры
Automatic Mount Points
  • When you change the mountpoint property from legacy or none to a specific path, ZFS automatically mounts the file system.
  • If ZFS is managing a file system but it is currently unmounted, and the mountpoint property is changed, the file system remains unmounted.

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/eschrock # 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/eschrock - /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.

Читайте также:  Сбой соединения vpn linux

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 tank /tank tank/home /tank/home tank/home/bonwick /tank/home/bonwick tank/ws /tank/ws

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

By default, ZFS does not allow mounting on top of a nonempty directory. To force a mount on top of a nonempty directory, you must use the -O option. For example:

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

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

# 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 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

Источник

Оцените статью
Adblock
detector