A clone is a writable volume or file system whose initial contents are the same as the dataset from which it was created. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional disk space.
Clones can only be created from a snapshot. When a snapshot is cloned, an implicit dependency is created between the clone and snapshot. Even though the clone is created somewhere else in the dataset hierarchy, the original snapshot cannot be destroyed as long as the clone exists. The origin property exposes this dependency, and the zfs destroy command lists any such dependencies, if they exist.
Clones do not inherit the properties of the dataset from which it was created. Rather, clones inherit their properties based on where the clones are created in the pool hierarchy. Use the zfs get and zfs set commands to view and change the properties of a cloned dataset. For more information about setting ZFS dataset properties, see .
Because a clone initially shares all its disk space with the original snapshot, its used property is initially zero. As changes are made to the clone, it uses more space. The used property of the original snapshot does not consider the disk space consumed by the clone.
To create a clone, use the zfs clone command, specifying the snapshot from which to create the clone, and the name of the new file system or volume. The new file system or volume can be located anywhere in the ZFS hierarchy. The type of the new dataset (for example, file system or volume) is the same type as the snapshot from which the clone was created. You cannot create clone of a file system in a pool that this different from where the original file system snapshot resides.
In the following example, a new clone named
tank/home/ahrens/bug123 with the same initial contents as the snapshot
tank/ws/gate@yesterday is created.
zfs snapshot tank/ws/gate@yesterday#
zfs clone tank/ws/gate@yesterday tank/home/ahrens/bug123
In the following example, a cloned workspace is created from the
projects/newproject@today snapshot for a temporary user as
projects/teamA/tempuser. Then, properties are set on the cloned workspace.
zfs snapshot projects/newproject@today#
zfs clone projects/newproject@today projects/teamA/tempuser#
zfs set sharenfs=on projects/teamA/tempuser#
zfs set quota=5G projects/teamA/tempuser