13ff01b23SMartin Matuska.\" 23ff01b23SMartin Matuska.\" CDDL HEADER START 33ff01b23SMartin Matuska.\" 43ff01b23SMartin Matuska.\" The contents of this file are subject to the terms of the 53ff01b23SMartin Matuska.\" Common Development and Distribution License (the "License"). 63ff01b23SMartin Matuska.\" You may not use this file except in compliance with the License. 73ff01b23SMartin Matuska.\" 83ff01b23SMartin Matuska.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0. 103ff01b23SMartin Matuska.\" See the License for the specific language governing permissions 113ff01b23SMartin Matuska.\" and limitations under the License. 123ff01b23SMartin Matuska.\" 133ff01b23SMartin Matuska.\" When distributing Covered Code, include this CDDL HEADER in each 143ff01b23SMartin Matuska.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153ff01b23SMartin Matuska.\" If applicable, add the following below this CDDL HEADER, with the 163ff01b23SMartin Matuska.\" fields enclosed by brackets "[]" replaced with your own identifying 173ff01b23SMartin Matuska.\" information: Portions Copyright [yyyy] [name of copyright owner] 183ff01b23SMartin Matuska.\" 193ff01b23SMartin Matuska.\" CDDL HEADER END 203ff01b23SMartin Matuska.\" 213ff01b23SMartin Matuska.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. 223ff01b23SMartin Matuska.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org> 233ff01b23SMartin Matuska.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved. 243ff01b23SMartin Matuska.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. 253ff01b23SMartin Matuska.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. 263ff01b23SMartin Matuska.\" Copyright (c) 2014 by Adam Stevko. All rights reserved. 273ff01b23SMartin Matuska.\" Copyright (c) 2014 Integros [integros.com] 283ff01b23SMartin Matuska.\" Copyright 2019 Richard Laager. All rights reserved. 293ff01b23SMartin Matuska.\" Copyright 2018 Nexenta Systems, Inc. 303ff01b23SMartin Matuska.\" Copyright 2019 Joyent, Inc. 31b2526e8bSMartin Matuska.\" Copyright 2023 Klara, Inc. 323ff01b23SMartin Matuska.\" 33b2526e8bSMartin Matuska.Dd October 6, 2023 343ff01b23SMartin Matuska.Dt ZFSCONCEPTS 7 353ff01b23SMartin Matuska.Os 363ff01b23SMartin Matuska. 373ff01b23SMartin Matuska.Sh NAME 383ff01b23SMartin Matuska.Nm zfsconcepts 393ff01b23SMartin Matuska.Nd overview of ZFS concepts 403ff01b23SMartin Matuska. 413ff01b23SMartin Matuska.Sh DESCRIPTION 423ff01b23SMartin Matuska.Ss ZFS File System Hierarchy 433ff01b23SMartin MatuskaA ZFS storage pool is a logical collection of devices that provide space for 443ff01b23SMartin Matuskadatasets. 453ff01b23SMartin MatuskaA storage pool is also the root of the ZFS file system hierarchy. 463ff01b23SMartin Matuska.Pp 473ff01b23SMartin MatuskaThe root of the pool can be accessed as a file system, such as mounting and 483ff01b23SMartin Matuskaunmounting, taking snapshots, and setting properties. 493ff01b23SMartin MatuskaThe physical storage characteristics, however, are managed by the 503ff01b23SMartin Matuska.Xr zpool 8 513ff01b23SMartin Matuskacommand. 523ff01b23SMartin Matuska.Pp 533ff01b23SMartin MatuskaSee 543ff01b23SMartin Matuska.Xr zpool 8 553ff01b23SMartin Matuskafor more information on creating and administering pools. 563ff01b23SMartin Matuska.Ss Snapshots 573ff01b23SMartin MatuskaA snapshot is a read-only copy of a file system or volume. 583ff01b23SMartin MatuskaSnapshots can be created extremely quickly, and initially consume no additional 593ff01b23SMartin Matuskaspace within the pool. 603ff01b23SMartin MatuskaAs data within the active dataset changes, the snapshot consumes more data than 613ff01b23SMartin Matuskawould otherwise be shared with the active dataset. 623ff01b23SMartin Matuska.Pp 633ff01b23SMartin MatuskaSnapshots can have arbitrary names. 643ff01b23SMartin MatuskaSnapshots of volumes can be cloned or rolled back, visibility is determined 653ff01b23SMartin Matuskaby the 663ff01b23SMartin Matuska.Sy snapdev 673ff01b23SMartin Matuskaproperty of the parent volume. 683ff01b23SMartin Matuska.Pp 693ff01b23SMartin MatuskaFile system snapshots can be accessed under the 703ff01b23SMartin Matuska.Pa .zfs/snapshot 713ff01b23SMartin Matuskadirectory in the root of the file system. 723ff01b23SMartin MatuskaSnapshots are automatically mounted on demand and may be unmounted at regular 733ff01b23SMartin Matuskaintervals. 74*7a7741afSMartin MatuskaThe availability and visibility of the 753ff01b23SMartin Matuska.Pa .zfs 763ff01b23SMartin Matuskadirectory can be controlled by the 773ff01b23SMartin Matuska.Sy snapdir 783ff01b23SMartin Matuskaproperty. 793ff01b23SMartin Matuska.Ss Bookmarks 803ff01b23SMartin MatuskaA bookmark is like a snapshot, a read-only copy of a file system or volume. 813ff01b23SMartin MatuskaBookmarks can be created extremely quickly, compared to snapshots, and they 823ff01b23SMartin Matuskaconsume no additional space within the pool. 833ff01b23SMartin MatuskaBookmarks can also have arbitrary names, much like snapshots. 843ff01b23SMartin Matuska.Pp 85bb2d13b6SMartin MatuskaUnlike snapshots, bookmarks can not be accessed through the filesystem in any 86bb2d13b6SMartin Matuskaway. 873ff01b23SMartin MatuskaFrom a storage standpoint a bookmark just provides a way to reference 883ff01b23SMartin Matuskawhen a snapshot was created as a distinct object. 893ff01b23SMartin MatuskaBookmarks are initially tied to a snapshot, not the filesystem or volume, 903ff01b23SMartin Matuskaand they will survive if the snapshot itself is destroyed. 913ff01b23SMartin MatuskaSince they are very light weight there's little incentive to destroy them. 923ff01b23SMartin Matuska.Ss Clones 933ff01b23SMartin MatuskaA clone is a writable volume or file system whose initial contents are the same 943ff01b23SMartin Matuskaas another dataset. 953ff01b23SMartin MatuskaAs with snapshots, creating a clone is nearly instantaneous, and initially 963ff01b23SMartin Matuskaconsumes no additional space. 973ff01b23SMartin Matuska.Pp 983ff01b23SMartin MatuskaClones can only be created from a snapshot. 993ff01b23SMartin MatuskaWhen a snapshot is cloned, it creates an implicit dependency between the parent 1003ff01b23SMartin Matuskaand child. 1013ff01b23SMartin MatuskaEven though the clone is created somewhere else in the dataset hierarchy, the 1023ff01b23SMartin Matuskaoriginal snapshot cannot be destroyed as long as a clone exists. 1033ff01b23SMartin MatuskaThe 1043ff01b23SMartin Matuska.Sy origin 1053ff01b23SMartin Matuskaproperty exposes this dependency, and the 1063ff01b23SMartin Matuska.Cm destroy 1073ff01b23SMartin Matuskacommand lists any such dependencies, if they exist. 1083ff01b23SMartin Matuska.Pp 1093ff01b23SMartin MatuskaThe clone parent-child dependency relationship can be reversed by using the 1103ff01b23SMartin Matuska.Cm promote 1113ff01b23SMartin Matuskasubcommand. 1123ff01b23SMartin MatuskaThis causes the 1133ff01b23SMartin Matuska.Qq origin 1143ff01b23SMartin Matuskafile system to become a clone of the specified file system, which makes it 1153ff01b23SMartin Matuskapossible to destroy the file system that the clone was created from. 1163ff01b23SMartin Matuska.Ss "Mount Points" 1173ff01b23SMartin MatuskaCreating a ZFS file system is a simple operation, so the number of file systems 1183ff01b23SMartin Matuskaper system is likely to be numerous. 1193ff01b23SMartin MatuskaTo cope with this, ZFS automatically manages mounting and unmounting file 1203ff01b23SMartin Matuskasystems without the need to edit the 1213ff01b23SMartin Matuska.Pa /etc/fstab 1223ff01b23SMartin Matuskafile. 1233ff01b23SMartin MatuskaAll automatically managed file systems are mounted by ZFS at boot time. 1243ff01b23SMartin Matuska.Pp 1253ff01b23SMartin MatuskaBy default, file systems are mounted under 1263ff01b23SMartin Matuska.Pa /path , 1273ff01b23SMartin Matuskawhere 1283ff01b23SMartin Matuska.Ar path 1293ff01b23SMartin Matuskais the name of the file system in the ZFS namespace. 1303ff01b23SMartin MatuskaDirectories are created and destroyed as needed. 1313ff01b23SMartin Matuska.Pp 1323ff01b23SMartin MatuskaA file system can also have a mount point set in the 1333ff01b23SMartin Matuska.Sy mountpoint 1343ff01b23SMartin Matuskaproperty. 1353ff01b23SMartin MatuskaThis directory is created as needed, and ZFS automatically mounts the file 1363ff01b23SMartin Matuskasystem when the 1373ff01b23SMartin Matuska.Nm zfs Cm mount Fl a 1383ff01b23SMartin Matuskacommand is invoked 1393ff01b23SMartin Matuska.Po without editing 1403ff01b23SMartin Matuska.Pa /etc/fstab 1413ff01b23SMartin Matuska.Pc . 1423ff01b23SMartin MatuskaThe 1433ff01b23SMartin Matuska.Sy mountpoint 1443ff01b23SMartin Matuskaproperty can be inherited, so if 1453ff01b23SMartin Matuska.Em pool/home 1463ff01b23SMartin Matuskahas a mount point of 1473ff01b23SMartin Matuska.Pa /export/stuff , 1483ff01b23SMartin Matuskathen 1493ff01b23SMartin Matuska.Em pool/home/user 1503ff01b23SMartin Matuskaautomatically inherits a mount point of 1513ff01b23SMartin Matuska.Pa /export/stuff/user . 1523ff01b23SMartin Matuska.Pp 1533ff01b23SMartin MatuskaA file system 1543ff01b23SMartin Matuska.Sy mountpoint 1553ff01b23SMartin Matuskaproperty of 1563ff01b23SMartin Matuska.Sy none 1573ff01b23SMartin Matuskaprevents the file system from being mounted. 1583ff01b23SMartin Matuska.Pp 1593ff01b23SMartin MatuskaIf needed, ZFS file systems can also be managed with traditional tools 1603ff01b23SMartin Matuska.Po 1613ff01b23SMartin Matuska.Nm mount , 1623ff01b23SMartin Matuska.Nm umount , 1633ff01b23SMartin Matuska.Pa /etc/fstab 1643ff01b23SMartin Matuska.Pc . 1653ff01b23SMartin MatuskaIf a file system's mount point is set to 1663ff01b23SMartin Matuska.Sy legacy , 1673ff01b23SMartin MatuskaZFS makes no attempt to manage the file system, and the administrator is 1683ff01b23SMartin Matuskaresponsible for mounting and unmounting the file system. 1693ff01b23SMartin MatuskaBecause pools must 1703ff01b23SMartin Matuskabe imported before a legacy mount can succeed, administrators should ensure 1713ff01b23SMartin Matuskathat legacy mounts are only attempted after the zpool import process 1723ff01b23SMartin Matuskafinishes at boot time. 1733ff01b23SMartin MatuskaFor example, on machines using systemd, the mount option 1743ff01b23SMartin Matuska.Pp 1753ff01b23SMartin Matuska.Nm x-systemd.requires=zfs-import.target 1763ff01b23SMartin Matuska.Pp 1773ff01b23SMartin Matuskawill ensure that the zfs-import completes before systemd attempts mounting 1783ff01b23SMartin Matuskathe filesystem. 1793ff01b23SMartin MatuskaSee 1803ff01b23SMartin Matuska.Xr systemd.mount 5 1813ff01b23SMartin Matuskafor details. 1823ff01b23SMartin Matuska.Ss Deduplication 1833ff01b23SMartin MatuskaDeduplication is the process for removing redundant data at the block level, 1843ff01b23SMartin Matuskareducing the total amount of data stored. 1853ff01b23SMartin MatuskaIf a file system has the 1863ff01b23SMartin Matuska.Sy dedup 1873ff01b23SMartin Matuskaproperty enabled, duplicate data blocks are removed synchronously. 1883ff01b23SMartin MatuskaThe result 1893ff01b23SMartin Matuskais that only unique data is stored and common components are shared among files. 1903ff01b23SMartin Matuska.Pp 1913ff01b23SMartin MatuskaDeduplicating data is a very resource-intensive operation. 1923ff01b23SMartin MatuskaIt is generally recommended that you have at least 1.25 GiB of RAM 1933ff01b23SMartin Matuskaper 1 TiB of storage when you enable deduplication. 1943ff01b23SMartin MatuskaCalculating the exact requirement depends heavily 1953ff01b23SMartin Matuskaon the type of data stored in the pool. 1963ff01b23SMartin Matuska.Pp 1973ff01b23SMartin MatuskaEnabling deduplication on an improperly-designed system can result in 198c03c5b1cSMartin Matuskaperformance issues (slow I/O and administrative operations). 1993ff01b23SMartin MatuskaIt can potentially lead to problems importing a pool due to memory exhaustion. 2003ff01b23SMartin MatuskaDeduplication can consume significant processing power (CPU) and memory as well 201c03c5b1cSMartin Matuskaas generate additional disk I/O. 2023ff01b23SMartin Matuska.Pp 2033ff01b23SMartin MatuskaBefore creating a pool with deduplication enabled, ensure that you have planned 2043ff01b23SMartin Matuskayour hardware requirements appropriately and implemented appropriate recovery 2053ff01b23SMartin Matuskapractices, such as regular backups. 2063ff01b23SMartin MatuskaConsider using the 2073ff01b23SMartin Matuska.Sy compression 2083ff01b23SMartin Matuskaproperty as a less resource-intensive alternative. 209b2526e8bSMartin Matuska.Ss Block cloning 210b2526e8bSMartin MatuskaBlock cloning is a facility that allows a file (or parts of a file) to be 211b2526e8bSMartin Matuska.Qq cloned , 212b2526e8bSMartin Matuskathat is, a shallow copy made where the existing data blocks are referenced 213b2526e8bSMartin Matuskarather than copied. 214b2526e8bSMartin MatuskaLater modifications to the data will cause a copy of the data block to be taken 215b2526e8bSMartin Matuskaand that copy modified. 216b2526e8bSMartin MatuskaThis facility is used to implement 217b2526e8bSMartin Matuska.Qq reflinks 218b2526e8bSMartin Matuskaor 219b2526e8bSMartin Matuska.Qq file-level copy-on-write . 220b2526e8bSMartin Matuska.Pp 221b2526e8bSMartin MatuskaCloned blocks are tracked in a special on-disk structure called the Block 222b2526e8bSMartin MatuskaReference Table 223b2526e8bSMartin Matuska.Po BRT 224b2526e8bSMartin Matuska.Pc . 225b2526e8bSMartin MatuskaUnlike deduplication, this table has minimal overhead, so can be enabled at all 226b2526e8bSMartin Matuskatimes. 227b2526e8bSMartin Matuska.Pp 228b2526e8bSMartin MatuskaAlso unlike deduplication, cloning must be requested by a user program. 229b2526e8bSMartin MatuskaMany common file copying programs, including newer versions of 230b2526e8bSMartin Matuska.Nm /bin/cp , 231b2526e8bSMartin Matuskawill try to create clones automatically. 232b2526e8bSMartin MatuskaLook for 233b2526e8bSMartin Matuska.Qq clone , 234b2526e8bSMartin Matuska.Qq dedupe 235b2526e8bSMartin Matuskaor 236b2526e8bSMartin Matuska.Qq reflink 237b2526e8bSMartin Matuskain the documentation for more information. 238b2526e8bSMartin Matuska.Pp 239b2526e8bSMartin MatuskaThere are some limitations to block cloning. 240b2526e8bSMartin MatuskaOnly whole blocks can be cloned, and blocks can not be cloned if they are not 241b2526e8bSMartin Matuskayet written to disk, or if they are encrypted, or the source and destination 242b2526e8bSMartin Matuska.Sy recordsize 243b2526e8bSMartin Matuskaproperties differ. 244b2526e8bSMartin MatuskaThe OS may add additional restrictions; 245b2526e8bSMartin Matuskafor example, most versions of Linux will not allow clones across datasets. 246