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