xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-create.8 (revision 1603881667360c015f6685131f2f25474fa67a72)
1eda14cbcSMatt Macy.\"
2eda14cbcSMatt Macy.\" CDDL HEADER START
3eda14cbcSMatt Macy.\"
4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy.\"
8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9eda14cbcSMatt Macy.\" or http://www.opensolaris.org/os/licensing.
10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11eda14cbcSMatt Macy.\" and limitations under the License.
12eda14cbcSMatt Macy.\"
13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy.\"
19eda14cbcSMatt Macy.\" CDDL HEADER END
20eda14cbcSMatt Macy.\"
21eda14cbcSMatt Macy.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
22eda14cbcSMatt Macy.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
23eda14cbcSMatt Macy.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
24eda14cbcSMatt Macy.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25eda14cbcSMatt Macy.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
26eda14cbcSMatt Macy.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
27eda14cbcSMatt Macy.\" Copyright (c) 2014 Integros [integros.com]
28eda14cbcSMatt Macy.\" Copyright 2019 Richard Laager. All rights reserved.
29eda14cbcSMatt Macy.\" Copyright 2018 Nexenta Systems, Inc.
30eda14cbcSMatt Macy.\" Copyright 2019 Joyent, Inc.
31eda14cbcSMatt Macy.\"
327877fdebSMatt Macy.Dd December 1, 2020
33eda14cbcSMatt Macy.Dt ZFS-CREATE 8
34eda14cbcSMatt Macy.Os
35*16038816SMartin Matuska.
36eda14cbcSMatt Macy.Sh NAME
377877fdebSMatt Macy.Nm zfs-create
38*16038816SMartin Matuska.Nd create ZFS dataset
39eda14cbcSMatt Macy.Sh SYNOPSIS
40eda14cbcSMatt Macy.Nm zfs
41eda14cbcSMatt Macy.Cm create
427877fdebSMatt Macy.Op Fl Pnpuv
43*16038816SMartin Matuska.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
44eda14cbcSMatt Macy.Ar filesystem
457877fdebSMatt Macy.Nm zfs
46eda14cbcSMatt Macy.Cm create
47eda14cbcSMatt Macy.Op Fl ps
48eda14cbcSMatt Macy.Op Fl b Ar blocksize
49*16038816SMartin Matuska.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
50eda14cbcSMatt Macy.Fl V Ar size Ar volume
51*16038816SMartin Matuska.
52eda14cbcSMatt Macy.Sh DESCRIPTION
53eda14cbcSMatt Macy.Bl -tag -width ""
54eda14cbcSMatt Macy.It Xo
557877fdebSMatt Macy.Nm zfs
56eda14cbcSMatt Macy.Cm create
577877fdebSMatt Macy.Op Fl Pnpuv
58*16038816SMartin Matuska.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
59eda14cbcSMatt Macy.Ar filesystem
60eda14cbcSMatt Macy.Xc
61eda14cbcSMatt MacyCreates a new ZFS file system.
62eda14cbcSMatt MacyThe file system is automatically mounted according to the
63eda14cbcSMatt Macy.Sy mountpoint
647877fdebSMatt Macyproperty inherited from the parent, unless the
657877fdebSMatt Macy.Fl u
667877fdebSMatt Macyoption is used.
67eda14cbcSMatt Macy.Bl -tag -width "-o"
68eda14cbcSMatt Macy.It Fl o Ar property Ns = Ns Ar value
69eda14cbcSMatt MacySets the specified property as if the command
70eda14cbcSMatt Macy.Nm zfs Cm set Ar property Ns = Ns Ar value
71eda14cbcSMatt Macywas invoked at the same time the dataset was created.
72eda14cbcSMatt MacyAny editable ZFS property can also be set at creation time.
73eda14cbcSMatt MacyMultiple
74eda14cbcSMatt Macy.Fl o
75eda14cbcSMatt Macyoptions can be specified.
76eda14cbcSMatt MacyAn error results if the same property is specified in multiple
77eda14cbcSMatt Macy.Fl o
78eda14cbcSMatt Macyoptions.
79eda14cbcSMatt Macy.It Fl p
80eda14cbcSMatt MacyCreates all the non-existing parent datasets.
81eda14cbcSMatt MacyDatasets created in this manner are automatically mounted according to the
82eda14cbcSMatt Macy.Sy mountpoint
83eda14cbcSMatt Macyproperty inherited from their parent.
84eda14cbcSMatt MacyAny property specified on the command line using the
85eda14cbcSMatt Macy.Fl o
86eda14cbcSMatt Macyoption is ignored.
87eda14cbcSMatt MacyIf the target filesystem already exists, the operation completes successfully.
88eda14cbcSMatt Macy.It Fl n
89eda14cbcSMatt MacyDo a dry-run
90eda14cbcSMatt Macy.Pq Qq No-op
91eda14cbcSMatt Macycreation.
92eda14cbcSMatt MacyNo datasets will be created.
93eda14cbcSMatt MacyThis is useful in conjunction with the
94eda14cbcSMatt Macy.Fl v
95eda14cbcSMatt Macyor
96eda14cbcSMatt Macy.Fl P
97eda14cbcSMatt Macyflags to validate properties that are passed via
98eda14cbcSMatt Macy.Fl o
99eda14cbcSMatt Macyoptions and those implied by other options.
100eda14cbcSMatt MacyThe actual dataset creation can still fail due to insufficient privileges or
101eda14cbcSMatt Macyavailable capacity.
102eda14cbcSMatt Macy.It Fl P
103eda14cbcSMatt MacyPrint machine-parsable verbose information about the created dataset.
104eda14cbcSMatt MacyEach line of output contains a key and one or two values, all separated by tabs.
105eda14cbcSMatt MacyThe
106eda14cbcSMatt Macy.Sy create_ancestors
107eda14cbcSMatt Macyand
108eda14cbcSMatt Macy.Sy create
109eda14cbcSMatt Macykeys have
110eda14cbcSMatt Macy.Em filesystem
111eda14cbcSMatt Macyas their only value.
112eda14cbcSMatt MacyThe
113eda14cbcSMatt Macy.Sy create_ancestors
114eda14cbcSMatt Macykey only appears if the
115eda14cbcSMatt Macy.Fl p
116eda14cbcSMatt Macyoption is used.
117eda14cbcSMatt MacyThe
118eda14cbcSMatt Macy.Sy property
119eda14cbcSMatt Macykey has two values, a property name that property's value.
120eda14cbcSMatt MacyThe
121eda14cbcSMatt Macy.Sy property
122eda14cbcSMatt Macykey may appear zero or more times, once for each property that will be set local
123eda14cbcSMatt Macyto
124eda14cbcSMatt Macy.Em filesystem
125eda14cbcSMatt Macydue to the use of the
126eda14cbcSMatt Macy.Fl o
127eda14cbcSMatt Macyoption.
1287877fdebSMatt Macy.It Fl u
1297877fdebSMatt MacyDo not mount the newly created file system.
130eda14cbcSMatt Macy.It Fl v
131eda14cbcSMatt MacyPrint verbose information about the created dataset.
132eda14cbcSMatt Macy.El
133eda14cbcSMatt Macy.It Xo
1347877fdebSMatt Macy.Nm zfs
135eda14cbcSMatt Macy.Cm create
136eda14cbcSMatt Macy.Op Fl ps
137eda14cbcSMatt Macy.Op Fl b Ar blocksize
138*16038816SMartin Matuska.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
139eda14cbcSMatt Macy.Fl V Ar size Ar volume
140eda14cbcSMatt Macy.Xc
141eda14cbcSMatt MacyCreates a volume of the given size.
142eda14cbcSMatt MacyThe volume is exported as a block device in
143eda14cbcSMatt Macy.Pa /dev/zvol/path ,
144eda14cbcSMatt Macywhere
145eda14cbcSMatt Macy.Em path
146eda14cbcSMatt Macyis the name of the volume in the ZFS namespace.
147eda14cbcSMatt MacyThe size represents the logical size as exported by the device.
148eda14cbcSMatt MacyBy default, a reservation of equal size is created.
149eda14cbcSMatt Macy.Pp
150eda14cbcSMatt Macy.Ar size
151eda14cbcSMatt Macyis automatically rounded up to the nearest multiple of the
152eda14cbcSMatt Macy.Sy blocksize .
153eda14cbcSMatt Macy.Bl -tag -width "-b"
154eda14cbcSMatt Macy.It Fl b Ar blocksize
155eda14cbcSMatt MacyEquivalent to
156eda14cbcSMatt Macy.Fl o Sy volblocksize Ns = Ns Ar blocksize .
157eda14cbcSMatt MacyIf this option is specified in conjunction with
158eda14cbcSMatt Macy.Fl o Sy volblocksize ,
159eda14cbcSMatt Macythe resulting behavior is undefined.
160eda14cbcSMatt Macy.It Fl o Ar property Ns = Ns Ar value
161eda14cbcSMatt MacySets the specified property as if the
162eda14cbcSMatt Macy.Nm zfs Cm set Ar property Ns = Ns Ar value
163eda14cbcSMatt Macycommand was invoked at the same time the dataset was created.
164eda14cbcSMatt MacyAny editable ZFS property can also be set at creation time.
165eda14cbcSMatt MacyMultiple
166eda14cbcSMatt Macy.Fl o
167eda14cbcSMatt Macyoptions can be specified.
168eda14cbcSMatt MacyAn error results if the same property is specified in multiple
169eda14cbcSMatt Macy.Fl o
170eda14cbcSMatt Macyoptions.
171eda14cbcSMatt Macy.It Fl p
172eda14cbcSMatt MacyCreates all the non-existing parent datasets.
173eda14cbcSMatt MacyDatasets created in this manner are automatically mounted according to the
174eda14cbcSMatt Macy.Sy mountpoint
175eda14cbcSMatt Macyproperty inherited from their parent.
176eda14cbcSMatt MacyAny property specified on the command line using the
177eda14cbcSMatt Macy.Fl o
178eda14cbcSMatt Macyoption is ignored.
179eda14cbcSMatt MacyIf the target filesystem already exists, the operation completes successfully.
180eda14cbcSMatt Macy.It Fl s
181eda14cbcSMatt MacyCreates a sparse volume with no reservation.
182eda14cbcSMatt MacySee
183eda14cbcSMatt Macy.Sy volsize
184eda14cbcSMatt Macyin the
185eda14cbcSMatt Macy.Em Native Properties
186eda14cbcSMatt Macysection of
187eda14cbcSMatt Macy.Xr zfsprops 8
188eda14cbcSMatt Macyfor more information about sparse volumes.
189eda14cbcSMatt Macy.It Fl n
190eda14cbcSMatt MacyDo a dry-run
191eda14cbcSMatt Macy.Pq Qq No-op
192eda14cbcSMatt Macycreation.
193eda14cbcSMatt MacyNo datasets will be created.
194eda14cbcSMatt MacyThis is useful in conjunction with the
195eda14cbcSMatt Macy.Fl v
196eda14cbcSMatt Macyor
197eda14cbcSMatt Macy.Fl P
198eda14cbcSMatt Macyflags to validate properties that are passed via
199eda14cbcSMatt Macy.Fl o
200eda14cbcSMatt Macyoptions and those implied by other options.
201eda14cbcSMatt MacyThe actual dataset creation can still fail due to insufficient privileges or
202eda14cbcSMatt Macyavailable capacity.
203eda14cbcSMatt Macy.It Fl P
204eda14cbcSMatt MacyPrint machine-parsable verbose information about the created dataset.
205eda14cbcSMatt MacyEach line of output contains a key and one or two values, all separated by tabs.
206eda14cbcSMatt MacyThe
207eda14cbcSMatt Macy.Sy create_ancestors
208eda14cbcSMatt Macyand
209eda14cbcSMatt Macy.Sy create
210eda14cbcSMatt Macykeys have
211eda14cbcSMatt Macy.Em volume
212eda14cbcSMatt Macyas their only value.
213eda14cbcSMatt MacyThe
214eda14cbcSMatt Macy.Sy create_ancestors
215eda14cbcSMatt Macykey only appears if the
216eda14cbcSMatt Macy.Fl p
217eda14cbcSMatt Macyoption is used.
218eda14cbcSMatt MacyThe
219eda14cbcSMatt Macy.Sy property
220eda14cbcSMatt Macykey has two values, a property name that property's value.
221eda14cbcSMatt MacyThe
222eda14cbcSMatt Macy.Sy property
223eda14cbcSMatt Macykey may appear zero or more times, once for each property that will be set local
224eda14cbcSMatt Macyto
225eda14cbcSMatt Macy.Em volume
226eda14cbcSMatt Macydue to the use of the
227eda14cbcSMatt Macy.Fl b
228eda14cbcSMatt Macyor
229eda14cbcSMatt Macy.Fl o
230eda14cbcSMatt Macyoptions, as well as
231eda14cbcSMatt Macy.Sy refreservation
232eda14cbcSMatt Macyif the volume is not sparse.
233eda14cbcSMatt Macy.It Fl v
234eda14cbcSMatt MacyPrint verbose information about the created dataset.
235eda14cbcSMatt Macy.El
236eda14cbcSMatt Macy.El
237eda14cbcSMatt Macy.Ss ZFS Volumes as Swap
238*16038816SMartin MatuskaZFS volumes may be used as swap devices.
239*16038816SMartin MatuskaAfter creating the volume with the
240eda14cbcSMatt Macy.Nm zfs Cm create Fl V
241*16038816SMartin Matuskaenable the swap area using the
242eda14cbcSMatt Macy.Xr swapon 8
243*16038816SMartin Matuskacommand.
244*16038816SMartin MatuskaSwapping to files on ZFS filesystems is not supported.
245*16038816SMartin Matuska.
246eda14cbcSMatt Macy.Sh SEE ALSO
247eda14cbcSMatt Macy.Xr zfs-destroy 8 ,
248eda14cbcSMatt Macy.Xr zfs-list 8 ,
249eda14cbcSMatt Macy.Xr zpool-create 8
250