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.
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.
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]
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.
38 .Nd create ZFS dataset
43 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
49 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
50 .Fl V Ar size Ar volume
58 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
61 Creates a new ZFS file system.
62 The file system is automatically mounted according to the
64 property inherited from the parent, unless the
68 .It Fl o Ar property Ns = Ns Ar value
69 Sets the specified property as if the command
70 .Nm zfs Cm set Ar property Ns = Ns Ar value
71 was invoked at the same time the dataset was created.
72 Any editable ZFS property can also be set at creation time.
75 options can be specified.
76 An error results if the same property is specified in multiple
80 Creates all the non-existing parent datasets.
81 Datasets created in this manner are automatically mounted according to the
83 property inherited from their parent.
84 Any property specified on the command line using the
87 If the target filesystem already exists, the operation completes successfully.
92 No datasets will be created.
93 This is useful in conjunction with the
97 flags to validate properties that are passed via
99 options and those implied by other options.
100 The actual dataset creation can still fail due to insufficient privileges or
103 Print machine-parsable verbose information about the created dataset.
104 Each line of output contains a key and one or two values, all separated by tabs.
114 key only appears if the
119 key has two values, a property name that property's value.
122 key may appear zero or more times, once for each property that will be set local
125 due to the use of the
129 Do not mount the newly created file system.
131 Print verbose information about the created dataset.
137 .Op Fl b Ar blocksize
138 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
139 .Fl V Ar size Ar volume
141 Creates a volume of the given size.
142 The volume is exported as a block device in
146 is the name of the volume in the ZFS namespace.
147 The size represents the logical size as exported by the device.
148 By default, a reservation of equal size is created.
151 is automatically rounded up to the nearest multiple of the
154 .It Fl b Ar blocksize
156 .Fl o Sy volblocksize Ns = Ns Ar blocksize .
157 If this option is specified in conjunction with
158 .Fl o Sy volblocksize ,
159 the resulting behavior is undefined.
160 .It Fl o Ar property Ns = Ns Ar value
161 Sets the specified property as if the
162 .Nm zfs Cm set Ar property Ns = Ns Ar value
163 command was invoked at the same time the dataset was created.
164 Any editable ZFS property can also be set at creation time.
167 options can be specified.
168 An error results if the same property is specified in multiple
172 Creates all the non-existing parent datasets.
173 Datasets created in this manner are automatically mounted according to the
175 property inherited from their parent.
176 Any property specified on the command line using the
179 If the target filesystem already exists, the operation completes successfully.
181 Creates a sparse volume with no reservation.
185 .Em Native Properties
188 for more information about sparse volumes.
193 No datasets will be created.
194 This is useful in conjunction with the
198 flags to validate properties that are passed via
200 options and those implied by other options.
201 The actual dataset creation can still fail due to insufficient privileges or
204 Print machine-parsable verbose information about the created dataset.
205 Each line of output contains a key and one or two values, all separated by tabs.
215 key only appears if the
220 key has two values, a property name that property's value.
223 key may appear zero or more times, once for each property that will be set local
226 due to the use of the
232 if the volume is not sparse.
234 Print verbose information about the created dataset.
238 Swapping to a ZFS volume is prone to deadlock and not recommended.
241 Swapping to a file on a ZFS filesystem is not supported.
244 .\" These are, respectively, examples 1, 10 from zfs.8
245 .\" Make sure to update them bidirectionally
246 .Ss Example 1 : No Creating a ZFS File System Hierarchy
247 The following commands create a file system named
249 and a file system named
253 is set for the parent file system, and is automatically inherited by the child
255 .Dl # Nm zfs Cm create Ar pool/home
256 .Dl # Nm zfs Cm set Sy mountpoint Ns = Ns Ar /export/home pool/home
257 .Dl # Nm zfs Cm create Ar pool/home/bob
259 .Ss Example 2 : No Promoting a ZFS Clone
260 The following commands illustrate how to test out changes to a file system, and
261 then replace the original file system with the changed one, using clones, clone
262 promotion, and renaming:
263 .Bd -literal -compact -offset Ds
264 .No # Nm zfs Cm create Ar pool/project/production
265 populate /pool/project/production with data
266 .No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
267 .No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
268 make changes to /pool/project/beta and test them
269 .No # Nm zfs Cm promote Ar pool/project/beta
270 .No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
271 .No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
272 once the legacy version is no longer needed, it can be destroyed
273 .No # Nm zfs Cm destroy Ar pool/project/legacy