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