| ||||||||||||||||||||||||||||
5.5.1.2 Legacy Mount PointsFilesystems 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.
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.
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 SystemsZFS 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.
The -a option can be used to mount all ZFS managed filesystems. Legacy managed filesystems are not mounted.
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.
Legacy mount points must be managed through legacy tools. An attempt to use ZFS tools result in an error.
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:
The mount option nosuid is an alias for nodevices,nosetuid. 5.5.3 Temporary Mount PropertiesIf 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.
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.
5.5.4 Unmounting File SystemsFilesystems 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.
Unmounting by mount point.
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.
To provide for backwards compatibility, the legacy umount(1M) command can be used to unmount ZFS filesystems.
5.5.5 Sharing ZFS File SystemsLike 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 SemanticsBy default, all filesystems are unshared. To share a new filesystem, run the following command:
The property is inherited, and filesystems are automatically shared on creation if their inherited property is not off. For example:
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 FilesystemsWhile 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:
This command unshares the tank/home/tabriz filesystem. To unshare all ZFS filesystems on the system, run:
5.5.5.3 Sharing FilesystemsAs 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:
You can also share all ZFS filesystems on the system:
5.5.5.4 Legacy SharesIf 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 ReservationsZFS 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. | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||