xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-create.8 (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
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) 2007, Sun Microsystems, Inc. All Rights Reserved.
23.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
24.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
25.\" Copyright (c) 2017 Datto Inc.
26.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
27.\" Copyright 2017 Nexenta Systems, Inc.
28.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
29.\" Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
30.\"
31.Dd March 16, 2022
32.Dt ZPOOL-CREATE 8
33.Os
34.
35.Sh NAME
36.Nm zpool-create
37.Nd create ZFS storage pool
38.Sh SYNOPSIS
39.Nm zpool
40.Cm create
41.Op Fl dfn
42.Op Fl m Ar mountpoint
43.Oo Fl o Ar property Ns = Ns Ar value Oc Ns …
44.Oo Fl o Sy feature@ Ns Ar feature Ns = Ns Ar value Oc
45.Op Fl o Ar compatibility Ns = Ns Sy off Ns | Ns Sy legacy Ns | Ns Ar file Ns Oo , Ns Ar file Oc Ns …
46.Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns …
47.Op Fl R Ar root
48.Op Fl t Ar tname
49.Ar pool
50.Ar vdev Ns …
51.
52.Sh DESCRIPTION
53Creates a new storage pool containing the virtual devices specified on the
54command line.
55The pool name must begin with a letter, and can only contain
56alphanumeric characters as well as the underscore
57.Pq Qq Sy _ ,
58dash
59.Pq Qq Sy \&- ,
60colon
61.Pq Qq Sy \&: ,
62space
63.Pq Qq Sy \&\  ,
64and period
65.Pq Qq Sy \&. .
66The pool names
67.Sy mirror ,
68.Sy raidz ,
69.Sy draid ,
70.Sy spare
71and
72.Sy log
73are reserved, as are names beginning with
74.Sy mirror ,
75.Sy raidz ,
76.Sy draid ,
77and
78.Sy spare .
79The
80.Ar vdev
81specification is described in the
82.Sx Virtual Devices
83section of
84.Xr zpoolconcepts 7 .
85.Pp
86The command attempts to verify that each device specified is accessible and not
87currently in use by another subsystem.
88However this check is not robust enough
89to detect simultaneous attempts to use a new device in different pools, even if
90.Sy multihost Ns = Sy enabled .
91The administrator must ensure that simultaneous invocations of any combination
92of
93.Nm zpool Cm replace ,
94.Nm zpool Cm create ,
95.Nm zpool Cm add ,
96or
97.Nm zpool Cm labelclear
98do not refer to the same device.
99Using the same device in two pools will result in pool corruption.
100.Pp
101There are some uses, such as being currently mounted, or specified as the
102dedicated dump device, that prevents a device from ever being used by ZFS.
103Other uses, such as having a preexisting UFS file system, can be overridden with
104.Fl f .
105.Pp
106The command also checks that the replication strategy for the pool is
107consistent.
108An attempt to combine redundant and non-redundant storage in a single pool,
109or to mix disks and files, results in an error unless
110.Fl f
111is specified.
112The use of differently-sized devices within a single raidz or mirror group is
113also flagged as an error unless
114.Fl f
115is specified.
116.Pp
117Unless the
118.Fl R
119option is specified, the default mount point is
120.Pa / Ns Ar pool .
121The mount point must not exist or must be empty, or else the root dataset
122will not be able to be be mounted.
123This can be overridden with the
124.Fl m
125option.
126.Pp
127By default all supported features are enabled on the new pool.
128The
129.Fl d
130option and the
131.Fl o Ar compatibility
132property
133.Pq e.g Fl o Sy compatibility Ns = Ns Ar 2020
134can be used to restrict the features that are enabled, so that the
135pool can be imported on other releases of ZFS.
136.Bl -tag -width "-t tname"
137.It Fl d
138Do not enable any features on the new pool.
139Individual features can be enabled by setting their corresponding properties to
140.Sy enabled
141with
142.Fl o .
143See
144.Xr zpool-features 7
145for details about feature properties.
146.It Fl f
147Forces use of
148.Ar vdev Ns s ,
149even if they appear in use or specify a conflicting replication level.
150Not all devices can be overridden in this manner.
151.It Fl m Ar mountpoint
152Sets the mount point for the root dataset.
153The default mount point is
154.Pa /pool
155or
156.Pa altroot/pool
157if
158.Sy altroot
159is specified.
160The mount point must be an absolute path,
161.Sy legacy ,
162or
163.Sy none .
164For more information on dataset mount points, see
165.Xr zfsprops 7 .
166.It Fl n
167Displays the configuration that would be used without actually creating the
168pool.
169The actual pool creation can still fail due to insufficient privileges or
170device sharing.
171.It Fl o Ar property Ns = Ns Ar value
172Sets the given pool properties.
173See
174.Xr zpoolprops 7
175for a list of valid properties that can be set.
176.It Fl o Ar compatibility Ns = Ns Sy off Ns | Ns Sy legacy Ns | Ns Ar file Ns Oo , Ns Ar file Oc Ns …
177Specifies compatibility feature sets.
178See
179.Xr zpool-features 7
180for more information about compatibility feature sets.
181.It Fl o Sy feature@ Ns Ar feature Ns = Ns Ar value
182Sets the given pool feature.
183See the
184.Xr zpool-features 7
185section for a list of valid features that can be set.
186Value can be either disabled or enabled.
187.It Fl O Ar file-system-property Ns = Ns Ar value
188Sets the given file system properties in the root file system of the pool.
189See
190.Xr zfsprops 7
191for a list of valid properties that can be set.
192.It Fl R Ar root
193Equivalent to
194.Fl o Sy cachefile Ns = Ns Sy none Fl o Sy altroot Ns = Ns Ar root
195.It Fl t Ar tname
196Sets the in-core pool name to
197.Ar tname
198while the on-disk name will be the name specified as
199.Ar pool .
200This will set the default of the
201.Sy cachefile
202property to
203.Sy none .
204This is intended
205to handle name space collisions when creating pools for other systems,
206such as virtual machines or physical machines whose pools live on network
207block devices.
208.El
209.
210.Sh EXAMPLES
211.\" These are, respectively, examples 1, 2, 3, 4, 11, 12 from zpool.8
212.\" Make sure to update them bidirectionally
213.Ss Example 1 : No Creating a RAID-Z Storage Pool
214The following command creates a pool with a single raidz root vdev that
215consists of six disks:
216.Dl # Nm zpool Cm create Ar tank Sy raidz Pa sda sdb sdc sdd sde sdf
217.
218.Ss Example 2 : No Creating a Mirrored Storage Pool
219The following command creates a pool with two mirrors, where each mirror
220contains two disks:
221.Dl # Nm zpool Cm create Ar tank Sy mirror Pa sda sdb Sy mirror Pa sdc sdd
222.
223.Ss Example 3 : No Creating a ZFS Storage Pool by Using Partitions
224The following command creates a non-redundant pool using two disk partitions:
225.Dl # Nm zpool Cm create Ar tank Pa sda1 sdb2
226.
227.Ss Example 4 : No Creating a ZFS Storage Pool by Using Files
228The following command creates a non-redundant pool using files.
229While not recommended, a pool based on files can be useful for experimental
230purposes.
231.Dl # Nm zpool Cm create Ar tank Pa /path/to/file/a /path/to/file/b
232.
233.Ss Example 5 : No Managing Hot Spares
234The following command creates a new pool with an available hot spare:
235.Dl # Nm zpool Cm create Ar tank Sy mirror Pa sda sdb Sy spare Pa sdc
236.
237.Ss Example 6 : No Creating a ZFS Pool with Mirrored Separate Intent Logs
238The following command creates a ZFS storage pool consisting of two, two-way
239mirrors and mirrored log devices:
240.Dl # Nm zpool Cm create Ar pool Sy mirror Pa sda sdb Sy mirror Pa sdc sdd Sy log mirror Pa sde sdf
241.
242.Sh SEE ALSO
243.Xr zpool-destroy 8 ,
244.Xr zpool-export 8 ,
245.Xr zpool-import 8
246