ZFS properties
ZFS is a file system that combines the roles of volume manager and file system. What is special here is that ZFS knows the structure of the storage media and a contiguous memory pool (zpool) is thus available. The memory pool is divided between the available file systems. As soon as more storage media are added to the pool, the existing file systems automatically grow with them and the new storage space is made available to all file systems.
Conventional file systems such as NTFS, ext3 or UFS behave differently. This separates hard disks, RAID controllers, volume managers, and file systems from one another. File systems can only be created on one hard disk at the same time. As soon as a second hard disk is added, two separate file systems have to be created.
Other advantages of ZFS are:
- RAID functionality is available by default.
- Switch-off-proof thanks to copy-on-write
- Automatic data error detection through checksums
- Convenient backup options through snapshots
vDev
The vDevs represent the basic hardware, such as HDDs, SSDs or CFast cards. There are various types of vDev. A vDev can consist of a hard disk, a group of hard disks, a file, a mirror of two or more hard disks or various RAID-Z configurations.
If several vDevs are used, then the data will be divided among the available vDevs in order to increase the speed and to utilize the storage space to the optimum. If one vdev fails, the data of the entire pool is lost. Suitable redundancy (e.g. RAID1) is therefore useful for a vdev.
Memory pool (zpool)
A memory pool (zpool) consists in turn of one or more vDevs. ZFS is based on a memory pool (zpool), which is essentially a collection of vDevs. The vDevs for their part represent the basic hardware, such as HDDs, SSDs or CFast cards, which store the data.
The vDevs are combined into a memory pool. A memory pool is used when one or more file systems (datasets) or block devices (volumes) are to be created. These datasets and volumes share the storage space available in the pool.
Datasets
Dataset is the general term for a ZFS file system, volume, snapshot or clone. Any number of datasets can be created, which are based on a memory pool and contain directories and files. Datasets are hierarchically based on one another. There is a root dataset with following parent datasets, child datasets and further graduations.
The datasets inherit all properties from the parents and grandparents. However, it is also possible to change and overwrite the default values inherited from the parents and grandparents. For each dataset properties such as compression, write and read access, storage space quotas or network shares can be defined.
Example of a dataset:
zroot/tmp
In this example, zroot/ is the root dataset and also the name of the memory pool (zpool) under TwinCAT/BSD. The command zfs list
can be used to display all available datasets.
The dataset zroot/ROOT/defaul
contains the basic system, all programs and TwinCAT. The dataset zroot/ROOT/restore
is a boot environment that can be used for restoring recovery points and resetting to factory settings (see Restore options). The other datasets are mounted at their respective mount points and can be accessed through the file system hierarchy (see Directory structure). Datasets facilitate customization of options such as read and write permissions for entire memory areas or limitation of storage space for log files or the home directory, for example. Furthermore, individual datasets can be backed up using snapshots.
In addition, zfs list
specifies the default mount point for each dataset, i.e. the point in the operating system's file system hierarchy through which the dataset can be accessed when it is mounted. Most datasets are mounted automatically directly after system startup. The command zfs mount
displays the datasets that are currently mounted. A file system, directory or device is only made accessible to the user when a dataset is mounted. The memory pool (zpool) and the associated datasets are mounted in TwinCAT/BSD directly after booting.
Volumes
A volume is a special type of dataset. It is not inserted as a file system and is instead a block device under /dev/zvol/poolname/dataset
. This allows the volume to be used for other file systems, to provide the hard disks to a virtual machine or to be exported via protocols such as iSCSI or HAST (Highly Available Storage). A volume can be formatted with any file system or it can function as a pure data memory. A volume appears to the user to be a normal disk with a fixed size.