]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/openzfs/man/man8/zfs-set.8
zfs: merge openzfs/zfs@1f940de07
[FreeBSD/FreeBSD.git] / sys / contrib / openzfs / man / man8 / zfs-set.8
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 April 20, 2024
33 .Dt ZFS-SET 8
34 .Os
35 .
36 .Sh NAME
37 .Nm zfs-set
38 .Nd set properties on ZFS datasets
39 .Sh SYNOPSIS
40 .Nm zfs
41 .Cm set
42 .Op Fl u
43 .Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns …
44 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns …
45 .Nm zfs
46 .Cm get
47 .Op Fl r Ns | Ns Fl d Ar depth
48 .Op Fl Hp
49 .Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
50 .Oo Fl s Ar source Ns Oo , Ns Ar source Oc Ns … Oc
51 .Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
52 .Cm all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns …
53 .Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Oc Ns …
54 .Nm zfs
55 .Cm inherit
56 .Op Fl rS
57 .Ar property Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns …
58 .
59 .Sh DESCRIPTION
60 .Bl -tag -width ""
61 .It Xo
62 .Nm zfs
63 .Cm set
64 .Op Fl u
65 .Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns …
66 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns …
67 .Xc
68 Only some properties can be edited.
69 See
70 .Xr zfsprops 7
71 for more information on what properties can be set and acceptable
72 values.
73 Numeric values can be specified as exact values, or in a human-readable form
74 with a suffix of
75 .Sy B , K , M , G , T , P , E , Z
76 .Po for bytes, kilobytes, megabytes, gigabytes, terabytes, petabytes, exabytes,
77 or zettabytes, respectively
78 .Pc .
79 User properties can be set on snapshots.
80 For more information, see the
81 .Em User Properties
82 section of
83 .Xr zfsprops 7 .
84 .Bl -tag -width "-u"
85 .It Fl u
86 Update mountpoint, sharenfs, sharesmb property but do not mount or share the
87 dataset.
88 .El
89 .It Xo
90 .Nm zfs
91 .Cm get
92 .Op Fl r Ns | Ns Fl d Ar depth
93 .Op Fl Hp
94 .Oo Fl o Ar field Ns Oo , Ns Ar field Oc Ns … Oc
95 .Oo Fl s Ar source Ns Oo , Ns Ar source Oc Ns … Oc
96 .Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
97 .Cm all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns …
98 .Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Oc Ns …
99 .Xc
100 Displays properties for the given datasets.
101 If no datasets are specified, then the command displays properties for all
102 datasets on the system.
103 For each property, the following columns are displayed:
104 .Bl -tag -compact -offset 4n -width "property"
105 .It Sy name
106 Dataset name
107 .It Sy property
108 Property name
109 .It Sy value
110 Property value
111 .It Sy source
112 Property source
113 .Sy local , default , inherited , temporary , received , No or Sy - Pq none .
114 .El
115 .Pp
116 All columns are displayed by default, though this can be controlled by using the
117 .Fl o
118 option.
119 This command takes a comma-separated list of properties as described in the
120 .Sx Native Properties
121 and
122 .Sx User Properties
123 sections of
124 .Xr zfsprops 7 .
125 .Pp
126 The value
127 .Sy all
128 can be used to display all properties that apply to the given dataset's type
129 .Pq Sy filesystem , volume , snapshot , No or Sy bookmark .
130 .Bl -tag -width "-s source"
131 .It Fl H
132 Display output in a form more easily parsed by scripts.
133 Any headers are omitted, and fields are explicitly separated by a single tab
134 instead of an arbitrary amount of space.
135 .It Fl d Ar depth
136 Recursively display any children of the dataset, limiting the recursion to
137 .Ar depth .
138 A depth of
139 .Sy 1
140 will display only the dataset and its direct children.
141 .It Fl o Ar field
142 A comma-separated list of columns to display, defaults to
143 .Sy name , Ns Sy property , Ns Sy value , Ns Sy source .
144 .It Fl p
145 Display numbers in parsable
146 .Pq exact
147 values.
148 .It Fl r
149 Recursively display properties for any children.
150 .It Fl s Ar source
151 A comma-separated list of sources to display.
152 Those properties coming from a source other than those in this list are ignored.
153 Each source must be one of the following:
154 .Sy local , default , inherited , temporary , received , No or Sy none .
155 The default value is all sources.
156 .It Fl t Ar type
157 A comma-separated list of types to display, where
158 .Ar type
159 is one of
160 .Sy filesystem , snapshot , volume , bookmark , No or Sy all .
161 .Sy fs ,
162 .Sy snap ,
163 or
164 .Sy vol
165 can be used as aliases for
166 .Sy filesystem ,
167 .Sy snapshot ,
168 or
169 .Sy volume .
170 .El
171 .It Xo
172 .Nm zfs
173 .Cm inherit
174 .Op Fl rS
175 .Ar property Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns …
176 .Xc
177 Clears the specified property, causing it to be inherited from an ancestor,
178 restored to default if no ancestor has the property set, or with the
179 .Fl S
180 option reverted to the received value if one exists.
181 See
182 .Xr zfsprops 7
183 for a listing of default values, and details on which properties can be
184 inherited.
185 .Bl -tag -width "-r"
186 .It Fl r
187 Recursively inherit the given property for all children.
188 .It Fl S
189 Revert the property to the received value, if one exists;
190 otherwise, for non-inheritable properties, to the default;
191 otherwise, operate as if the
192 .Fl S
193 option was not specified.
194 .El
195 .El
196 .
197 .Sh EXAMPLES
198 .\" These are, respectively, examples 1, 4, 6, 7, 11, 14, 16 from zfs.8
199 .\" Make sure to update them bidirectionally
200 .Ss Example 1 : No Creating a ZFS File System Hierarchy
201 The following commands create a file system named
202 .Ar pool/home
203 and a file system named
204 .Ar pool/home/bob .
205 The mount point
206 .Pa /export/home
207 is set for the parent file system, and is automatically inherited by the child
208 file system.
209 .Dl # Nm zfs Cm create Ar pool/home
210 .Dl # Nm zfs Cm set Sy mountpoint Ns = Ns Ar /export/home pool/home
211 .Dl # Nm zfs Cm create Ar pool/home/bob
212 .
213 .Ss Example 2 : No Disabling and Enabling File System Compression
214 The following command disables the
215 .Sy compression
216 property for all file systems under
217 .Ar pool/home .
218 The next command explicitly enables
219 .Sy compression
220 for
221 .Ar pool/home/anne .
222 .Dl # Nm zfs Cm set Sy compression Ns = Ns Sy off Ar pool/home
223 .Dl # Nm zfs Cm set Sy compression Ns = Ns Sy on Ar pool/home/anne
224 .
225 .Ss Example 3 : No Setting a Quota on a ZFS File System
226 The following command sets a quota of 50 Gbytes for
227 .Ar pool/home/bob :
228 .Dl # Nm zfs Cm set Sy quota Ns = Ns Ar 50G pool/home/bob
229 .
230 .Ss Example 4 : No Listing ZFS Properties
231 The following command lists all properties for
232 .Ar pool/home/bob :
233 .Bd -literal -compact -offset Ds
234 .No # Nm zfs Cm get Sy all Ar pool/home/bob
235 NAME           PROPERTY              VALUE                  SOURCE
236 pool/home/bob  type                  filesystem             -
237 pool/home/bob  creation              Tue Jul 21 15:53 2009  -
238 pool/home/bob  used                  21K                    -
239 pool/home/bob  available             20.0G                  -
240 pool/home/bob  referenced            21K                    -
241 pool/home/bob  compressratio         1.00x                  -
242 pool/home/bob  mounted               yes                    -
243 pool/home/bob  quota                 20G                    local
244 pool/home/bob  reservation           none                   default
245 pool/home/bob  recordsize            128K                   default
246 pool/home/bob  mountpoint            /pool/home/bob         default
247 pool/home/bob  sharenfs              off                    default
248 pool/home/bob  checksum              on                     default
249 pool/home/bob  compression           on                     local
250 pool/home/bob  atime                 on                     default
251 pool/home/bob  devices               on                     default
252 pool/home/bob  exec                  on                     default
253 pool/home/bob  setuid                on                     default
254 pool/home/bob  readonly              off                    default
255 pool/home/bob  zoned                 off                    default
256 pool/home/bob  snapdir               hidden                 default
257 pool/home/bob  acltype               off                    default
258 pool/home/bob  aclmode               discard                default
259 pool/home/bob  aclinherit            restricted             default
260 pool/home/bob  canmount              on                     default
261 pool/home/bob  xattr                 on                     default
262 pool/home/bob  copies                1                      default
263 pool/home/bob  version               4                      -
264 pool/home/bob  utf8only              off                    -
265 pool/home/bob  normalization         none                   -
266 pool/home/bob  casesensitivity       sensitive              -
267 pool/home/bob  vscan                 off                    default
268 pool/home/bob  nbmand                off                    default
269 pool/home/bob  sharesmb              off                    default
270 pool/home/bob  refquota              none                   default
271 pool/home/bob  refreservation        none                   default
272 pool/home/bob  primarycache          all                    default
273 pool/home/bob  secondarycache        all                    default
274 pool/home/bob  usedbysnapshots       0                      -
275 pool/home/bob  usedbydataset         21K                    -
276 pool/home/bob  usedbychildren        0                      -
277 pool/home/bob  usedbyrefreservation  0                      -
278 .Ed
279 .Pp
280 The following command gets a single property value:
281 .Bd -literal -compact -offset Ds
282 .No # Nm zfs Cm get Fl H o Sy value compression Ar pool/home/bob
283 on
284 .Ed
285 .Pp
286 The following command lists all properties with local settings for
287 .Ar pool/home/bob :
288 .Bd -literal -compact -offset Ds
289 .No # Nm zfs Cm get Fl r s Sy local Fl o Sy name , Ns Sy property , Ns Sy value all Ar pool/home/bob
290 NAME           PROPERTY              VALUE
291 pool/home/bob  quota                 20G
292 pool/home/bob  compression           on
293 .Ed
294 .
295 .Ss Example 5 : No Inheriting ZFS Properties
296 The following command causes
297 .Ar pool/home/bob No and Ar pool/home/anne
298 to inherit the
299 .Sy checksum
300 property from their parent.
301 .Dl # Nm zfs Cm inherit Sy checksum Ar pool/home/bob pool/home/anne
302 .
303 .Ss Example 6 : No Setting User Properties
304 The following example sets the user-defined
305 .Ar com.example : Ns Ar department
306 property for a dataset:
307 .Dl # Nm zfs Cm set Ar com.example : Ns Ar department Ns = Ns Ar 12345 tank/accounting
308 .
309 .Ss Example 7 : No Setting sharenfs Property Options on a ZFS File System
310 The following commands show how to set
311 .Sy sharenfs
312 property options to enable read-write
313 access for a set of IP addresses and to enable root access for system
314 .Qq neo
315 on the
316 .Ar tank/home
317 file system:
318 .Dl # Nm zfs Cm set Sy sharenfs Ns = Ns ' Ns Ar rw Ns =@123.123.0.0/16:[::1],root= Ns Ar neo Ns ' tank/home
319 .Pp
320 If you are using DNS for host name resolution,
321 specify the fully-qualified hostname.
322 .
323 .Sh SEE ALSO
324 .Xr zfsprops 7 ,
325 .Xr zfs-list 8