xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-clone.8 (revision 271171e0d97b88ba2a7c3bf750c9672b484c1c13)
1eda14cbcSMatt Macy.\"
2eda14cbcSMatt Macy.\" CDDL HEADER START
3eda14cbcSMatt Macy.\"
4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy.\"
8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0.
10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11eda14cbcSMatt Macy.\" and limitations under the License.
12eda14cbcSMatt Macy.\"
13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy.\"
19eda14cbcSMatt Macy.\" CDDL HEADER END
20eda14cbcSMatt Macy.\"
21eda14cbcSMatt Macy.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
22eda14cbcSMatt Macy.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
23eda14cbcSMatt Macy.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
24eda14cbcSMatt Macy.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25eda14cbcSMatt Macy.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
26eda14cbcSMatt Macy.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
27eda14cbcSMatt Macy.\" Copyright (c) 2014 Integros [integros.com]
28eda14cbcSMatt Macy.\" Copyright 2019 Richard Laager. All rights reserved.
29eda14cbcSMatt Macy.\" Copyright 2018 Nexenta Systems, Inc.
30eda14cbcSMatt Macy.\" Copyright 2019 Joyent, Inc.
31eda14cbcSMatt Macy.\"
32da5137abSMartin Matuska.Dd March 16, 2022
33eda14cbcSMatt Macy.Dt ZFS-CLONE 8
34eda14cbcSMatt Macy.Os
3516038816SMartin Matuska.
36eda14cbcSMatt Macy.Sh NAME
377877fdebSMatt Macy.Nm zfs-clone
3816038816SMartin Matuska.Nd clone snapshot of ZFS dataset
39eda14cbcSMatt Macy.Sh SYNOPSIS
407877fdebSMatt Macy.Nm zfs
41eda14cbcSMatt Macy.Cm clone
42eda14cbcSMatt Macy.Op Fl p
4316038816SMartin Matuska.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
44eda14cbcSMatt Macy.Ar snapshot Ar filesystem Ns | Ns Ar volume
4516038816SMartin Matuska.
46eda14cbcSMatt Macy.Sh DESCRIPTION
47eda14cbcSMatt MacySee the
4816038816SMartin Matuska.Sx Clones
49eda14cbcSMatt Macysection of
503ff01b23SMartin Matuska.Xr zfsconcepts 7
51eda14cbcSMatt Macyfor details.
5216038816SMartin MatuskaThe target dataset can be located anywhere in the ZFS hierarchy,
5316038816SMartin Matuskaand is created as the same type as the original.
5416038816SMartin Matuska.Bl -tag -width Ds
55eda14cbcSMatt Macy.It Fl o Ar property Ns = Ns Ar value
56eda14cbcSMatt MacySets the specified property; see
57eda14cbcSMatt Macy.Nm zfs Cm create
58eda14cbcSMatt Macyfor details.
59eda14cbcSMatt Macy.It Fl p
60eda14cbcSMatt MacyCreates all the non-existing parent datasets.
61eda14cbcSMatt MacyDatasets created in this manner are automatically mounted according to the
62eda14cbcSMatt Macy.Sy mountpoint
63eda14cbcSMatt Macyproperty inherited from their parent.
64eda14cbcSMatt MacyIf the target filesystem or volume already exists, the operation completes
65eda14cbcSMatt Macysuccessfully.
66eda14cbcSMatt Macy.El
6716038816SMartin Matuska.
68da5137abSMartin Matuska.Sh EXAMPLES
69da5137abSMartin Matuska.\" These are, respectively, examples 9, 10 from zfs.8
70da5137abSMartin Matuska.\" Make sure to update them bidirectionally
71da5137abSMartin Matuska.Ss Example 1 : No Creating a ZFS Clone
72da5137abSMartin MatuskaThe following command creates a writable file system whose initial contents are
73da5137abSMartin Matuskathe same as
74da5137abSMartin Matuska.Ar pool/home/bob@yesterday .
75da5137abSMartin Matuska.Dl # Nm zfs Cm clone Ar pool/home/bob@yesterday pool/clone
76da5137abSMartin Matuska.
77da5137abSMartin Matuska.Ss Example 2 : No Promoting a ZFS Clone
78da5137abSMartin MatuskaThe following commands illustrate how to test out changes to a file system, and
79da5137abSMartin Matuskathen replace the original file system with the changed one, using clones, clone
80da5137abSMartin Matuskapromotion, and renaming:
81da5137abSMartin Matuska.Bd -literal -compact -offset Ds
82da5137abSMartin Matuska.No # Nm zfs Cm create Ar pool/project/production
83da5137abSMartin Matuska  populate /pool/project/production with data
84da5137abSMartin Matuska.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
85da5137abSMartin Matuska.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
86da5137abSMartin Matuska  make changes to /pool/project/beta and test them
87da5137abSMartin Matuska.No # Nm zfs Cm promote Ar pool/project/beta
88da5137abSMartin Matuska.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
89da5137abSMartin Matuska.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
90da5137abSMartin Matuska  once the legacy version is no longer needed, it can be destroyed
91da5137abSMartin Matuska.No # Nm zfs Cm destroy Ar pool/project/legacy
92da5137abSMartin Matuska.Ed
93da5137abSMartin Matuska.
94eda14cbcSMatt Macy.Sh SEE ALSO
95eda14cbcSMatt Macy.Xr zfs-promote 8 ,
96eda14cbcSMatt Macy.Xr zfs-snapshot 8
97