]> git.proxmox.com Git - mirror_zfs.git/blame - man/man8/zfs-rename.8
FreeBSD: Add zfs_link_create() error handling
[mirror_zfs.git] / man / man8 / zfs-rename.8
CommitLineData
870fc32f
RW
1.\"
2.\" CDDL HEADER START
3.\"
4.\" The contents of this file are subject to the terms of the
5.\" Common Development and Distribution License (the "License").
6.\" You may not use this file except in compliance with the License.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1d3ba0bf 9.\" or https://opensource.org/licenses/CDDL-1.0.
870fc32f
RW
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
13.\" When distributing Covered Code, include this CDDL HEADER in each
14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15.\" If applicable, add the following below this CDDL HEADER, with the
16.\" fields enclosed by brackets "[]" replaced with your own identifying
17.\" information: Portions Copyright [yyyy] [name of copyright owner]
18.\"
19.\" CDDL HEADER END
20.\"
870fc32f
RW
21.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
22.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
23.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
24.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
26.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
27.\" Copyright (c) 2014 Integros [integros.com]
28.\" Copyright 2019 Richard Laager. All rights reserved.
29.\" Copyright 2018 Nexenta Systems, Inc.
30.\" Copyright 2019 Joyent, Inc.
31.\"
b61595ff 32.Dd March 16, 2022
870fc32f 33.Dt ZFS-RENAME 8
6706552e 34.Os
f84fe3fc 35.
870fc32f 36.Sh NAME
1e36af8c 37.Nm zfs-rename
f84fe3fc 38.Nd rename ZFS dataset
870fc32f 39.Sh SYNOPSIS
1e36af8c 40.Nm zfs
870fc32f
RW
41.Cm rename
42.Op Fl f
43.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
44.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
1e36af8c 45.Nm zfs
870fc32f 46.Cm rename
7b4e2723
RM
47.Fl p
48.Op Fl f
870fc32f
RW
49.Ar filesystem Ns | Ns Ar volume
50.Ar filesystem Ns | Ns Ar volume
1e36af8c 51.Nm zfs
7b4e2723
RM
52.Cm rename
53.Fl u
54.Op Fl f
782b1c12 55.Ar filesystem Ar filesystem
1e36af8c 56.Nm zfs
782b1c12
RM
57.Cm rename
58.Fl r
59.Ar snapshot Ar snapshot
f84fe3fc 60.
870fc32f
RW
61.Sh DESCRIPTION
62.Bl -tag -width ""
63.It Xo
1e36af8c 64.Nm zfs
870fc32f
RW
65.Cm rename
66.Op Fl f
67.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
68.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
69.Xc
70.It Xo
1e36af8c 71.Nm zfs
870fc32f 72.Cm rename
7b4e2723
RM
73.Fl p
74.Op Fl f
870fc32f
RW
75.Ar filesystem Ns | Ns Ar volume
76.Ar filesystem Ns | Ns Ar volume
77.Xc
7b4e2723 78.It Xo
1e36af8c 79.Nm zfs
7b4e2723
RM
80.Cm rename
81.Fl u
82.Op Fl f
83.Ar filesystem
84.Ar filesystem
85.Xc
870fc32f
RW
86Renames the given dataset.
87The new target can be located anywhere in the ZFS hierarchy, with the exception
88of snapshots.
89Snapshots can only be renamed within the parent file system or volume.
90When renaming a snapshot, the parent file system of the snapshot does not need
91to be specified as part of the second argument.
92Renamed file systems can inherit new mount points, in which case they are
93unmounted and remounted at the new mount point.
94.Bl -tag -width "-a"
95.It Fl f
7b4e2723
RM
96Force unmount any file systems that need to be unmounted in the process.
97This flag has no effect if used together with the
98.Fl u
99flag.
870fc32f
RW
100.It Fl p
101Creates all the nonexistent parent datasets.
102Datasets created in this manner are automatically mounted according to the
103.Sy mountpoint
104property inherited from their parent.
7b4e2723
RM
105.It Fl u
106Do not remount file systems during rename.
107If a file system's
108.Sy mountpoint
109property is set to
110.Sy legacy
111or
112.Sy none ,
113the file system is not unmounted even if this option is not given.
870fc32f
RW
114.El
115.It Xo
1e36af8c 116.Nm zfs
870fc32f
RW
117.Cm rename
118.Fl r
119.Ar snapshot Ar snapshot
120.Xc
121Recursively rename the snapshots of all descendent datasets.
122Snapshots are the only dataset that can be renamed recursively.
123.El
b61595ff
AZ
124.
125.Sh EXAMPLES
126.\" These are, respectively, examples 10, 15 from zfs.8
127.\" Make sure to update them bidirectionally
128.Ss Example 1 : No Promoting a ZFS Clone
129The following commands illustrate how to test out changes to a file system, and
130then replace the original file system with the changed one, using clones, clone
131promotion, and renaming:
132.Bd -literal -compact -offset Ds
133.No # Nm zfs Cm create Ar pool/project/production
134 populate /pool/project/production with data
135.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
136.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
137 make changes to /pool/project/beta and test them
138.No # Nm zfs Cm promote Ar pool/project/beta
139.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
140.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
141 once the legacy version is no longer needed, it can be destroyed
142.No # Nm zfs Cm destroy Ar pool/project/legacy
143.Ed
144.
145.Ss Example 2 : No Performing a Rolling Snapshot
146The following example shows how to maintain a history of snapshots with a
147consistent naming scheme.
148To keep a week's worth of snapshots, the user destroys the oldest snapshot,
149renames the remaining snapshots, and then creates a new snapshot, as follows:
150.Bd -literal -compact -offset Ds
151.No # Nm zfs Cm destroy Fl r Ar pool/users@7daysago
152.No # Nm zfs Cm rename Fl r Ar pool/users@6daysago No @ Ns Ar 7daysago
153.No # Nm zfs Cm rename Fl r Ar pool/users@5daysago No @ Ns Ar 6daysago
154.No # Nm zfs Cm rename Fl r Ar pool/users@4daysago No @ Ns Ar 5daysago
155.No # Nm zfs Cm rename Fl r Ar pool/users@3daysago No @ Ns Ar 4daysago
156.No # Nm zfs Cm rename Fl r Ar pool/users@2daysago No @ Ns Ar 3daysago
157.No # Nm zfs Cm rename Fl r Ar pool/users@yesterday No @ Ns Ar 2daysago
158.No # Nm zfs Cm rename Fl r Ar pool/users@today No @ Ns Ar yesterday
159.No # Nm zfs Cm snapshot Fl r Ar pool/users Ns @ Ns Ar today
160.Ed