Creating a ZFS Clone

To create a clone, use the zfs clone command, specifying the snapshot or dataset from which to create the clone and the name of the new file system or volume, which can be located anywhere in the ZFS hierarchy. The new dataset is the same type (for example, file system or volume) as the snapshot from which the clone was created. You cannot create a clone of a file system in a pool that is different from where the original file system snapshot resides.

The following example creates a new clone named system1/home/megra/bug123 with the same initial contents as the snapshot system1/ws/gate@yesterday.

$ zfs snapshot system1/ws/gate@yesterday
$ zfs clone system1/ws/gate@yesterday system1/home/megra/bug123

The following example creates a cloned workspace from the projects/newproject@today snapshot for a temporary user as projects/teamA/tempuser. Properties then are set on the cloned workspace.

$ zfs snapshot projects/newproject@today
$ zfs clone projects/newproject@today projects/teamA/tempuser
$ zfs set share.nfs=on projects/teamA/tempuser
$ zfs set quota=5G projects/teamA/tempuser