| |||
6.2 ZFS ClonesA clone is a writable volume or filesystem whose initial contents are the same as another dataset. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space. Clones can only be created from a snapshot. When a snapshot is cloned, it creates an implicit dependency 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 they are created. Rather, clones inherit their properties based on where they 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 5.4.1 Setting Properties. Since a clone initially shares all its space with the original snapshot, its space used property is initially zero. As changes are made to the clone, it uses more space. The space used property of the original snapshot does not take into account the space consumed by the clone. 6.2.1 Creating a CloneTo create a clone use the zfs clone command, specifying the snapshot from which to create it, and the name of the new filesystem or volume. The new filesystem or volume can be located anywhere in the ZFS hierarchy. The type of the new dataset (for example, filesystem or volume) is the same as the snapshot from which it was created. The following example creates a new clone named pool/home/ahrens/bug123 with the same initial contents as the snapshot pool/ws/gate@yesterday.
The following example creates a cloned work space from the projects/newproject@today snapshot for a temporary user as projects/teamA/tempuser and then sets properties on the cloned work space.
6.2.2 Destroying a CloneZFS clones are destroyed with the zfs destroy command.
Clones must be destroyed before the parent snapshot can be destroyed. | |||
| |||