xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-create.8 (revision 7b5e687355afe772894661db63d1d4466751d806)
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
9271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0.
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) 2007, Sun Microsystems, Inc. All Rights Reserved.
22eda14cbcSMatt Macy.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
23eda14cbcSMatt Macy.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
24eda14cbcSMatt Macy.\" Copyright (c) 2017 Datto Inc.
25eda14cbcSMatt Macy.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
26eda14cbcSMatt Macy.\" Copyright 2017 Nexenta Systems, Inc.
27eda14cbcSMatt Macy.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
28ee36e25aSMartin Matuska.\" Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
29eda14cbcSMatt Macy.\"
30da5137abSMartin Matuska.Dd March 16, 2022
31eda14cbcSMatt Macy.Dt ZPOOL-CREATE 8
32eda14cbcSMatt Macy.Os
3316038816SMartin Matuska.
34eda14cbcSMatt Macy.Sh NAME
357877fdebSMatt Macy.Nm zpool-create
3616038816SMartin Matuska.Nd create ZFS storage pool
37eda14cbcSMatt Macy.Sh SYNOPSIS
387877fdebSMatt Macy.Nm zpool
39eda14cbcSMatt Macy.Cm create
40eda14cbcSMatt Macy.Op Fl dfn
41eda14cbcSMatt Macy.Op Fl m Ar mountpoint
4216038816SMartin Matuska.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
4316038816SMartin Matuska.Oo Fl o Sy feature@ Ns Ar feature Ns = Ns Ar value Oc
4416038816SMartin Matuska.Op Fl o Ar compatibility Ns = Ns Sy off Ns | Ns Sy legacy Ns | Ns Ar file Ns Oo , Ns Ar file Oc Ns …
4516038816SMartin Matuska.Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns …
46eda14cbcSMatt Macy.Op Fl R Ar root
47eda14cbcSMatt Macy.Op Fl t Ar tname
4816038816SMartin Matuska.Ar pool
4916038816SMartin Matuska.Ar vdev Ns …
5016038816SMartin Matuska.
5116038816SMartin Matuska.Sh DESCRIPTION
52eda14cbcSMatt MacyCreates a new storage pool containing the virtual devices specified on the
53eda14cbcSMatt Macycommand line.
54eda14cbcSMatt MacyThe pool name must begin with a letter, and can only contain
5516038816SMartin Matuskaalphanumeric characters as well as the underscore
56eda14cbcSMatt Macy.Pq Qq Sy _ ,
57eda14cbcSMatt Macydash
58eda14cbcSMatt Macy.Pq Qq Sy \&- ,
59eda14cbcSMatt Macycolon
60eda14cbcSMatt Macy.Pq Qq Sy \&: ,
61eda14cbcSMatt Macyspace
62eda14cbcSMatt Macy.Pq Qq Sy \&\  ,
63eda14cbcSMatt Macyand period
64eda14cbcSMatt Macy.Pq Qq Sy \&. .
65eda14cbcSMatt MacyThe pool names
66eda14cbcSMatt Macy.Sy mirror ,
67eda14cbcSMatt Macy.Sy raidz ,
687877fdebSMatt Macy.Sy draid ,
69eda14cbcSMatt Macy.Sy spare
70eda14cbcSMatt Macyand
71eda14cbcSMatt Macy.Sy log
72eda14cbcSMatt Macyare reserved, as are names beginning with
73eda14cbcSMatt Macy.Sy mirror ,
74eda14cbcSMatt Macy.Sy raidz ,
757877fdebSMatt Macy.Sy draid ,
7616038816SMartin Matuskaand
7716038816SMartin Matuska.Sy spare .
78eda14cbcSMatt MacyThe
79eda14cbcSMatt Macy.Ar vdev
80eda14cbcSMatt Macyspecification is described in the
8116038816SMartin Matuska.Sx Virtual Devices
82eda14cbcSMatt Macysection of
833ff01b23SMartin Matuska.Xr zpoolconcepts 7 .
84eda14cbcSMatt Macy.Pp
85eda14cbcSMatt MacyThe command attempts to verify that each device specified is accessible and not
8616038816SMartin Matuskacurrently in use by another subsystem.
8716038816SMartin MatuskaHowever this check is not robust enough
88eda14cbcSMatt Macyto detect simultaneous attempts to use a new device in different pools, even if
8916038816SMartin Matuska.Sy multihost Ns = Sy enabled .
90*7b5e6873SMartin MatuskaThe administrator must ensure that simultaneous invocations of any combination
91bb2d13b6SMartin Matuskaof
9216038816SMartin Matuska.Nm zpool Cm replace ,
9316038816SMartin Matuska.Nm zpool Cm create ,
9416038816SMartin Matuska.Nm zpool Cm add ,
95eda14cbcSMatt Macyor
96*7b5e6873SMartin Matuska.Nm zpool Cm labelclear
9716038816SMartin Matuskado not refer to the same device.
9816038816SMartin MatuskaUsing the same device in two pools will result in pool corruption.
99eda14cbcSMatt Macy.Pp
100eda14cbcSMatt MacyThere are some uses, such as being currently mounted, or specified as the
101eda14cbcSMatt Macydedicated dump device, that prevents a device from ever being used by ZFS.
102eda14cbcSMatt MacyOther uses, such as having a preexisting UFS file system, can be overridden with
10316038816SMartin Matuska.Fl f .
104eda14cbcSMatt Macy.Pp
105eda14cbcSMatt MacyThe command also checks that the replication strategy for the pool is
106eda14cbcSMatt Macyconsistent.
10716038816SMartin MatuskaAn attempt to combine redundant and non-redundant storage in a single pool,
10816038816SMartin Matuskaor to mix disks and files, results in an error unless
109eda14cbcSMatt Macy.Fl f
110eda14cbcSMatt Macyis specified.
11116038816SMartin MatuskaThe use of differently-sized devices within a single raidz or mirror group is
112eda14cbcSMatt Macyalso flagged as an error unless
113eda14cbcSMatt Macy.Fl f
114eda14cbcSMatt Macyis specified.
115eda14cbcSMatt Macy.Pp
116eda14cbcSMatt MacyUnless the
117eda14cbcSMatt Macy.Fl R
118eda14cbcSMatt Macyoption is specified, the default mount point is
119eda14cbcSMatt Macy.Pa / Ns Ar pool .
120eda14cbcSMatt MacyThe mount point must not exist or must be empty, or else the root dataset
12116038816SMartin Matuskawill not be able to be be mounted.
122eda14cbcSMatt MacyThis can be overridden with the
123eda14cbcSMatt Macy.Fl m
124eda14cbcSMatt Macyoption.
125eda14cbcSMatt Macy.Pp
12616038816SMartin MatuskaBy default all supported features are enabled on the new pool.
12716038816SMartin MatuskaThe
128eda14cbcSMatt Macy.Fl d
12916038816SMartin Matuskaoption and the
130ee36e25aSMartin Matuska.Fl o Ar compatibility
13116038816SMartin Matuskaproperty
13216038816SMartin Matuska.Pq e.g Fl o Sy compatibility Ns = Ns Ar 2020
13316038816SMartin Matuskacan be used to restrict the features that are enabled, so that the
13416038816SMartin Matuskapool can be imported on other releases of ZFS.
13516038816SMartin Matuska.Bl -tag -width "-t tname"
136eda14cbcSMatt Macy.It Fl d
137eda14cbcSMatt MacyDo not enable any features on the new pool.
138eda14cbcSMatt MacyIndividual features can be enabled by setting their corresponding properties to
139eda14cbcSMatt Macy.Sy enabled
14016038816SMartin Matuskawith
14116038816SMartin Matuska.Fl o .
142eda14cbcSMatt MacySee
1433ff01b23SMartin Matuska.Xr zpool-features 7
144eda14cbcSMatt Macyfor details about feature properties.
145eda14cbcSMatt Macy.It Fl f
146eda14cbcSMatt MacyForces use of
147eda14cbcSMatt Macy.Ar vdev Ns s ,
148eda14cbcSMatt Macyeven if they appear in use or specify a conflicting replication level.
149eda14cbcSMatt MacyNot all devices can be overridden in this manner.
150eda14cbcSMatt Macy.It Fl m Ar mountpoint
151eda14cbcSMatt MacySets the mount point for the root dataset.
152eda14cbcSMatt MacyThe default mount point is
153eda14cbcSMatt Macy.Pa /pool
154eda14cbcSMatt Macyor
155eda14cbcSMatt Macy.Pa altroot/pool
156eda14cbcSMatt Macyif
15716038816SMartin Matuska.Sy altroot
158eda14cbcSMatt Macyis specified.
159eda14cbcSMatt MacyThe mount point must be an absolute path,
160eda14cbcSMatt Macy.Sy legacy ,
161eda14cbcSMatt Macyor
162eda14cbcSMatt Macy.Sy none .
163eda14cbcSMatt MacyFor more information on dataset mount points, see
1643ff01b23SMartin Matuska.Xr zfsprops 7 .
165eda14cbcSMatt Macy.It Fl n
166eda14cbcSMatt MacyDisplays the configuration that would be used without actually creating the
167eda14cbcSMatt Macypool.
168eda14cbcSMatt MacyThe actual pool creation can still fail due to insufficient privileges or
169eda14cbcSMatt Macydevice sharing.
170eda14cbcSMatt Macy.It Fl o Ar property Ns = Ns Ar value
171eda14cbcSMatt MacySets the given pool properties.
17216038816SMartin MatuskaSee
1733ff01b23SMartin Matuska.Xr zpoolprops 7
17416038816SMartin Matuskafor a list of valid properties that can be set.
17516038816SMartin Matuska.It Fl o Ar compatibility Ns = Ns Sy off Ns | Ns Sy legacy Ns | Ns Ar file Ns Oo , Ns Ar file Oc Ns …
17616038816SMartin MatuskaSpecifies compatibility feature sets.
17716038816SMartin MatuskaSee
1783ff01b23SMartin Matuska.Xr zpool-features 7
179ee36e25aSMartin Matuskafor more information about compatibility feature sets.
18016038816SMartin Matuska.It Fl o Sy feature@ Ns Ar feature Ns = Ns Ar value
18116038816SMartin MatuskaSets the given pool feature.
18216038816SMartin MatuskaSee the
1833ff01b23SMartin Matuska.Xr zpool-features 7
184eda14cbcSMatt Macysection for a list of valid features that can be set.
185eda14cbcSMatt MacyValue can be either disabled or enabled.
186eda14cbcSMatt Macy.It Fl O Ar file-system-property Ns = Ns Ar value
187eda14cbcSMatt MacySets the given file system properties in the root file system of the pool.
18816038816SMartin MatuskaSee
1893ff01b23SMartin Matuska.Xr zfsprops 7
19016038816SMartin Matuskafor a list of valid properties that can be set.
191eda14cbcSMatt Macy.It Fl R Ar root
192eda14cbcSMatt MacyEquivalent to
193eda14cbcSMatt Macy.Fl o Sy cachefile Ns = Ns Sy none Fl o Sy altroot Ns = Ns Ar root
194eda14cbcSMatt Macy.It Fl t Ar tname
195eda14cbcSMatt MacySets the in-core pool name to
19616038816SMartin Matuska.Ar tname
19716038816SMartin Matuskawhile the on-disk name will be the name specified as
19816038816SMartin Matuska.Ar pool .
19916038816SMartin MatuskaThis will set the default of the
20016038816SMartin Matuska.Sy cachefile
20116038816SMartin Matuskaproperty to
20216038816SMartin Matuska.Sy none .
20316038816SMartin MatuskaThis is intended
204eda14cbcSMatt Macyto handle name space collisions when creating pools for other systems,
205eda14cbcSMatt Macysuch as virtual machines or physical machines whose pools live on network
206eda14cbcSMatt Macyblock devices.
207eda14cbcSMatt Macy.El
20816038816SMartin Matuska.
209da5137abSMartin Matuska.Sh EXAMPLES
210da5137abSMartin Matuska.\" These are, respectively, examples 1, 2, 3, 4, 11, 12 from zpool.8
211da5137abSMartin Matuska.\" Make sure to update them bidirectionally
212da5137abSMartin Matuska.Ss Example 1 : No Creating a RAID-Z Storage Pool
213da5137abSMartin MatuskaThe following command creates a pool with a single raidz root vdev that
214da5137abSMartin Matuskaconsists of six disks:
215da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Sy raidz Pa sda sdb sdc sdd sde sdf
216da5137abSMartin Matuska.
217da5137abSMartin Matuska.Ss Example 2 : No Creating a Mirrored Storage Pool
218da5137abSMartin MatuskaThe following command creates a pool with two mirrors, where each mirror
219da5137abSMartin Matuskacontains two disks:
220da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Sy mirror Pa sda sdb Sy mirror Pa sdc sdd
221da5137abSMartin Matuska.
222da5137abSMartin Matuska.Ss Example 3 : No Creating a ZFS Storage Pool by Using Partitions
223da5137abSMartin MatuskaThe following command creates a non-redundant pool using two disk partitions:
224da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Pa sda1 sdb2
225da5137abSMartin Matuska.
226da5137abSMartin Matuska.Ss Example 4 : No Creating a ZFS Storage Pool by Using Files
227da5137abSMartin MatuskaThe following command creates a non-redundant pool using files.
228da5137abSMartin MatuskaWhile not recommended, a pool based on files can be useful for experimental
229da5137abSMartin Matuskapurposes.
230da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Pa /path/to/file/a /path/to/file/b
231da5137abSMartin Matuska.
232da5137abSMartin Matuska.Ss Example 5 : No Managing Hot Spares
233da5137abSMartin MatuskaThe following command creates a new pool with an available hot spare:
234da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Sy mirror Pa sda sdb Sy spare Pa sdc
235da5137abSMartin Matuska.
236da5137abSMartin Matuska.Ss Example 6 : No Creating a ZFS Pool with Mirrored Separate Intent Logs
237da5137abSMartin MatuskaThe following command creates a ZFS storage pool consisting of two, two-way
238da5137abSMartin Matuskamirrors and mirrored log devices:
239da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar pool Sy mirror Pa sda sdb Sy mirror Pa sdc sdd Sy log mirror Pa sde sdf
240da5137abSMartin Matuska.
241eda14cbcSMatt Macy.Sh SEE ALSO
242eda14cbcSMatt Macy.Xr zpool-destroy 8 ,
243eda14cbcSMatt Macy.Xr zpool-export 8 ,
244eda14cbcSMatt Macy.Xr zpool-import 8
245