xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-hold.8 (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
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
9.\" or http://www.opensolaris.org/os/licensing.
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.\"
21.\"
22.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
23.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
24.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
25.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
26.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
27.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
28.\" Copyright (c) 2014 Integros [integros.com]
29.\" Copyright 2019 Richard Laager. All rights reserved.
30.\" Copyright 2018 Nexenta Systems, Inc.
31.\" Copyright 2019 Joyent, Inc.
32.\"
33.Dd June 30, 2019
34.Dt ZFS-HOLD 8
35.Os
36.Sh NAME
37.Nm zfs-hold
38.Nd Hold a snapshot to prevent it being removed with the zfs destroy command.
39.Sh SYNOPSIS
40.Nm zfs
41.Cm hold
42.Op Fl r
43.Ar tag Ar snapshot Ns ...
44.Nm zfs
45.Cm holds
46.Op Fl rH
47.Ar snapshot Ns ...
48.Nm zfs
49.Cm release
50.Op Fl r
51.Ar tag Ar snapshot Ns ...
52.Sh DESCRIPTION
53.Bl -tag -width ""
54.It Xo
55.Nm zfs
56.Cm hold
57.Op Fl r
58.Ar tag Ar snapshot Ns ...
59.Xc
60Adds a single reference, named with the
61.Ar tag
62argument, to the specified snapshot or snapshots.
63Each snapshot has its own tag namespace, and tags must be unique within that
64space.
65.Pp
66If a hold exists on a snapshot, attempts to destroy that snapshot by using the
67.Nm zfs Cm destroy
68command return
69.Er EBUSY .
70.Bl -tag -width "-r"
71.It Fl r
72Specifies that a hold with the given tag is applied recursively to the snapshots
73of all descendent file systems.
74.El
75.It Xo
76.Nm zfs
77.Cm holds
78.Op Fl rH
79.Ar snapshot Ns ...
80.Xc
81Lists all existing user references for the given snapshot or snapshots.
82.Bl -tag -width "-r"
83.It Fl r
84Lists the holds that are set on the named descendent snapshots, in addition to
85listing the holds on the named snapshot.
86.It Fl H
87Do not print headers, use tab-delimited output.
88.El
89.It Xo
90.Nm zfs
91.Cm release
92.Op Fl r
93.Ar tag Ar snapshot Ns ...
94.Xc
95Removes a single reference, named with the
96.Ar tag
97argument, from the specified snapshot or snapshots.
98The tag must already exist for each snapshot.
99If a hold exists on a snapshot, attempts to destroy that snapshot by using the
100.Nm zfs Cm destroy
101command return
102.Er EBUSY .
103.Bl -tag -width "-r"
104.It Fl r
105Recursively releases a hold with the given tag on the snapshots of all
106descendent file systems.
107.El
108.El
109.Sh SEE ALSO
110.Xr zfs-destroy 8
111