After creating a storage pool to store your data, you can create your file system hierarchy. Hierarchies are simple yet powerful mechanisms for organizing information. They are also very familiar to anyone who has used a file system.
ZFS allows file systems to be organized into arbitrary hierarchies, where each file system has only a single parent. The root of the hierarchy is always the pool name. ZFS leverages this hierarchy by supporting property inheritance so that common properties can be set quickly and easily on entire trees of file systems.
Determining the ZFS File System Hierarchy
Pick the file system granularity.
ZFS file systems are the central point of administration. They are lightweight and can be created easily. A good model to use is a file system per user or project, as this model allows properties, snapshots, and backups to be controlled on a per-user or per-project basis.
Two ZFS file systems,
billm, are created in .
For more information on managing file systems, see.
Group similar file systems.
ZFS allows file systems to be organized into hierarchies so that similar file systems can be grouped. This model provides a central point of administration for controlling properties and administering file systems. Similar file systems should be created under a common name.
For the example in
Choose the file system properties.
Most file system characteristics are controlled by using simple properties. These properties control a variety of behavior, including where the file systems are mounted, how they are shared, if they use compression, and if any quotas are in effect.
For the example in
user, are shared by using NFS, and with compression enabled.
In addition, a quota of 10 Gbytes on
bonwick is enforced.
For more information about properties, see.
Creating ZFS File Systems
Become root or assume an equivalent role with the appropriate ZFS rights profile.
For more information about the ZFS rights profiles, see.
Create the desired hierarchy.
zfs create tank/home
Next, individual file systems are grouped under the
system in the pool
Set the inherited properties.
After the file system hierarchy is established, set up any properties that should be shared among all users:
zfs set mountpoint=/export/zfs tank/home#
zfs set sharenfs=on tank/home#
zfs set compression=on tank/home#
zfs get compression tank/homeNAME PROPERTY VALUE SOURCE tank/home compression on local
Create the individual file systems.
Note that the
file systems could have been created and then the properties could have been
changed at the
home level. All properties can be changed
dynamically while file systems are in use.
zfs create tank/home/bonwick#
zfs create tank/home/billm
These file systems inherit their property settings from their parent,
so they are automatically mounted at
user and are NFS shared. You do not need to edit the
For more information about creating file systems, see.
For more information about mounting and sharing file systems, see.
Set the file system-specific properties.
zfs set quota=10G tank/home/bonwick
View the results.
View available file system information by using the zfs list command:
zfs listNAME USED AVAIL REFER MOUNTPOINT tank 92.0K 67.0G 9.5K /tank tank/home 24.0K 67.0G 8K /export/zfs tank/home/billm 8K 67.0G 8K /export/zfs/billm tank/home/bonwick 8K 10.0G 8K /export/zfs/bonwick
For more information about viewing file system status, see.
For more information about how space is used and calculated, see.