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 https://opensource.org/licenses/CDDL-1.0.
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.\" 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.\"
32.Dd June 30, 2019
33.Dt ZFS-HOLD 8
34.Os
35.
36.Sh NAME
37.Nm zfs-hold
38.Nd hold ZFS snapshots to prevent their removal
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 rHp
47.Ar snapshot Ns …
48.Nm zfs
49.Cm release
50.Op Fl r
51.Ar tag Ar snapshot Ns …
52.
53.Sh DESCRIPTION
54.Bl -tag -width ""
55.It Xo
56.Nm zfs
57.Cm hold
58.Op Fl r
59.Ar tag Ar snapshot Ns …
60.Xc
61Adds a single reference, named with the
62.Ar tag
63argument, to the specified snapshots.
64Each snapshot has its own tag namespace, and tags must be unique within that
65space.
66.Pp
67If a hold exists on a snapshot, attempts to destroy that snapshot by using the
68.Nm zfs Cm destroy
69command return
70.Sy EBUSY .
71.Bl -tag -width "-r"
72.It Fl r
73Specifies that a hold with the given tag is applied recursively to the snapshots
74of all descendent file systems.
75.El
76.It Xo
77.Nm zfs
78.Cm holds
79.Op Fl rHp
80.Ar snapshot Ns …
81.Xc
82Lists all existing user references for the given snapshot or snapshots.
83.Bl -tag -width "-r"
84.It Fl r
85Lists the holds that are set on the named descendent snapshots, in addition to
86listing the holds on the named snapshot.
87.It Fl H
88Do not print headers, use tab-delimited output.
89.It Fl p
90Prints holds timestamps as unix epoch timestamps.
91.El
92.It Xo
93.Nm zfs
94.Cm release
95.Op Fl r
96.Ar tag Ar snapshot Ns …
97.Xc
98Removes a single reference, named with the
99.Ar tag
100argument, from the specified snapshot or snapshots.
101The tag must already exist for each snapshot.
102If a hold exists on a snapshot, attempts to destroy that snapshot by using the
103.Nm zfs Cm destroy
104command return
105.Sy EBUSY .
106.Bl -tag -width "-r"
107.It Fl r
108Recursively releases a hold with the given tag on the snapshots of all
109descendent file systems.
110.El
111.El
112.
113.Sh SEE ALSO
114.Xr zfs-destroy 8
115