xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-import.8 (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1.\"
2.\" CDDL HEADER START
3.\"
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.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9.\" or http://www.opensolaris.org/os/licensing.
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
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]
18.\"
19.\" CDDL HEADER END
20.\"
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.\"
30.Dd August 9, 2019
31.Dt ZPOOL-IMPORT 8
32.Os
33.Sh NAME
34.Nm zpool-import
35.Nd Lists ZFS storage pools available to import or import the specified pools
36.Sh SYNOPSIS
37.Nm zpool
38.Cm import
39.Op Fl D
40.Op Fl d Ar dir Ns | Ns device
41.Nm zpool
42.Cm import
43.Fl a
44.Op Fl DflmN
45.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
46.Op Fl -rewind-to-checkpoint
47.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns device
48.Op Fl o Ar mntopts
49.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
50.Op Fl R Ar root
51.Nm zpool
52.Cm import
53.Op Fl Dflm
54.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
55.Op Fl -rewind-to-checkpoint
56.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns device
57.Op Fl o Ar mntopts
58.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
59.Op Fl R Ar root
60.Op Fl s
61.Ar pool Ns | Ns Ar id
62.Op Ar newpool Oo Fl t Oc
63.Sh DESCRIPTION
64.Bl -tag -width Ds
65.It Xo
66.Nm zpool
67.Cm import
68.Op Fl D
69.Op Fl d Ar dir Ns | Ns device
70.Xc
71Lists pools available to import.
72If the
73.Fl d or
74.Fl c
75options are not specified, this command searches for devices using libblkid
76on Linux and geom on FreeBSD.
77The
78.Fl d
79option can be specified multiple times, and all directories are searched.
80If the device appears to be part of an exported pool, this command displays a
81summary of the pool with the name of the pool, a numeric identifier, as well as
82the vdev layout and current health of the device for each device or file.
83Destroyed pools, pools that were previously destroyed with the
84.Nm zpool Cm destroy
85command, are not listed unless the
86.Fl D
87option is specified.
88.Pp
89The numeric identifier is unique, and can be used instead of the pool name when
90multiple exported pools of the same name are available.
91.Bl -tag -width Ds
92.It Fl c Ar cachefile
93Reads configuration from the given
94.Ar cachefile
95that was created with the
96.Sy cachefile
97pool property.
98This
99.Ar cachefile
100is used instead of searching for devices.
101.It Fl d Ar dir Ns | Ns Ar device
102Uses
103.Ar device
104or searches for devices or files in
105.Ar dir .
106The
107.Fl d
108option can be specified multiple times.
109.It Fl D
110Lists destroyed pools only.
111.El
112.It Xo
113.Nm zpool
114.Cm import
115.Fl a
116.Op Fl DflmN
117.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
118.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns device
119.Op Fl o Ar mntopts
120.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
121.Op Fl R Ar root
122.Op Fl s
123.Xc
124Imports all pools found in the search directories.
125Identical to the previous command, except that all pools with a sufficient
126number of devices available are imported.
127Destroyed pools, pools that were previously destroyed with the
128.Nm zpool Cm destroy
129command, will not be imported unless the
130.Fl D
131option is specified.
132.Bl -tag -width Ds
133.It Fl a
134Searches for and imports all pools found.
135.It Fl c Ar cachefile
136Reads configuration from the given
137.Ar cachefile
138that was created with the
139.Sy cachefile
140pool property.
141This
142.Ar cachefile
143is used instead of searching for devices.
144.It Fl d Ar dir Ns | Ns Ar device
145Uses
146.Ar device
147or searches for devices or files in
148.Ar dir .
149The
150.Fl d
151option can be specified multiple times.
152This option is incompatible with the
153.Fl c
154option.
155.It Fl D
156Imports destroyed pools only.
157The
158.Fl f
159option is also required.
160.It Fl f
161Forces import, even if the pool appears to be potentially active.
162.It Fl F
163Recovery mode for a non-importable pool.
164Attempt to return the pool to an importable state by discarding the last few
165transactions.
166Not all damaged pools can be recovered by using this option.
167If successful, the data from the discarded transactions is irretrievably lost.
168This option is ignored if the pool is importable or already imported.
169.It Fl l
170Indicates that this command will request encryption keys for all encrypted
171datasets it attempts to mount as it is bringing the pool online. Note that if
172any datasets have a
173.Sy keylocation
174of
175.Sy prompt
176this command will block waiting for the keys to be entered. Without this flag
177encrypted datasets will be left unavailable until the keys are loaded.
178.It Fl m
179Allows a pool to import when there is a missing log device.
180Recent transactions can be lost because the log device will be discarded.
181.It Fl n
182Used with the
183.Fl F
184recovery option.
185Determines whether a non-importable pool can be made importable again, but does
186not actually perform the pool recovery.
187For more details about pool recovery mode, see the
188.Fl F
189option, above.
190.It Fl N
191Import the pool without mounting any file systems.
192.It Fl o Ar mntopts
193Comma-separated list of mount options to use when mounting datasets within the
194pool.
195See
196.Xr zfs 8
197for a description of dataset properties and mount options.
198.It Fl o Ar property Ns = Ns Ar value
199Sets the specified property on the imported pool.
200See the
201.Xr zpoolprops
202manual page for more information on the available pool properties.
203.It Fl R Ar root
204Sets the
205.Sy cachefile
206property to
207.Sy none
208and the
209.Sy altroot
210property to
211.Ar root .
212.It Fl -rewind-to-checkpoint
213Rewinds pool to the checkpointed state.
214Once the pool is imported with this flag there is no way to undo the rewind.
215All changes and data that were written after the checkpoint are lost!
216The only exception is when the
217.Sy readonly
218mounting option is enabled.
219In this case, the checkpointed state of the pool is opened and an
220administrator can see how the pool would look like if they were
221to fully rewind.
222.It Fl s
223Scan using the default search path, the libblkid cache will not be
224consulted. A custom search path may be specified by setting the
225ZPOOL_IMPORT_PATH environment variable.
226.It Fl X
227Used with the
228.Fl F
229recovery option. Determines whether extreme
230measures to find a valid txg should take place. This allows the pool to
231be rolled back to a txg which is no longer guaranteed to be consistent.
232Pools imported at an inconsistent txg may contain uncorrectable
233checksum errors. For more details about pool recovery mode, see the
234.Fl F
235option, above. WARNING: This option can be extremely hazardous to the
236health of your pool and should only be used as a last resort.
237.It Fl T
238Specify the txg to use for rollback. Implies
239.Fl FX .
240For more details
241about pool recovery mode, see the
242.Fl X
243option, above. WARNING: This option can be extremely hazardous to the
244health of your pool and should only be used as a last resort.
245.El
246.It Xo
247.Nm zpool
248.Cm import
249.Op Fl Dflm
250.Op Fl F Oo Fl n Oc Oo Fl t Oc Oo Fl T Oc Oo Fl X Oc
251.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir Ns | Ns device
252.Op Fl o Ar mntopts
253.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
254.Op Fl R Ar root
255.Op Fl s
256.Ar pool Ns | Ns Ar id
257.Op Ar newpool
258.Xc
259Imports a specific pool.
260A pool can be identified by its name or the numeric identifier.
261If
262.Ar newpool
263is specified, the pool is imported using the name
264.Ar newpool .
265Otherwise, it is imported with the same name as its exported name.
266.Pp
267If a device is removed from a system without running
268.Nm zpool Cm export
269first, the device appears as potentially active.
270It cannot be determined if this was a failed export, or whether the device is
271really in use from another host.
272To import a pool in this state, the
273.Fl f
274option is required.
275.Bl -tag -width Ds
276.It Fl c Ar cachefile
277Reads configuration from the given
278.Ar cachefile
279that was created with the
280.Sy cachefile
281pool property.
282This
283.Ar cachefile
284is used instead of searching for devices.
285.It Fl d Ar dir Ns | Ns Ar device
286Uses
287.Ar device
288or searches for devices or files in
289.Ar dir .
290The
291.Fl d
292option can be specified multiple times.
293This option is incompatible with the
294.Fl c
295option.
296.It Fl D
297Imports destroyed pool.
298The
299.Fl f
300option is also required.
301.It Fl f
302Forces import, even if the pool appears to be potentially active.
303.It Fl F
304Recovery mode for a non-importable pool.
305Attempt to return the pool to an importable state by discarding the last few
306transactions.
307Not all damaged pools can be recovered by using this option.
308If successful, the data from the discarded transactions is irretrievably lost.
309This option is ignored if the pool is importable or already imported.
310.It Fl l
311Indicates that this command will request encryption keys for all encrypted
312datasets it attempts to mount as it is bringing the pool online. Note that if
313any datasets have a
314.Sy keylocation
315of
316.Sy prompt
317this command will block waiting for the keys to be entered. Without this flag
318encrypted datasets will be left unavailable until the keys are loaded.
319.It Fl m
320Allows a pool to import when there is a missing log device.
321Recent transactions can be lost because the log device will be discarded.
322.It Fl n
323Used with the
324.Fl F
325recovery option.
326Determines whether a non-importable pool can be made importable again, but does
327not actually perform the pool recovery.
328For more details about pool recovery mode, see the
329.Fl F
330option, above.
331.It Fl o Ar mntopts
332Comma-separated list of mount options to use when mounting datasets within the
333pool.
334See
335.Xr zfs 8
336for a description of dataset properties and mount options.
337.It Fl o Ar property Ns = Ns Ar value
338Sets the specified property on the imported pool.
339See the
340.Xr zpoolprops
341manual page for more information on the available pool properties.
342.It Fl R Ar root
343Sets the
344.Sy cachefile
345property to
346.Sy none
347and the
348.Sy altroot
349property to
350.Ar root .
351.It Fl s
352Scan using the default search path, the libblkid cache will not be
353consulted. A custom search path may be specified by setting the
354ZPOOL_IMPORT_PATH environment variable.
355.It Fl X
356Used with the
357.Fl F
358recovery option. Determines whether extreme
359measures to find a valid txg should take place. This allows the pool to
360be rolled back to a txg which is no longer guaranteed to be consistent.
361Pools imported at an inconsistent txg may contain uncorrectable
362checksum errors. For more details about pool recovery mode, see the
363.Fl F
364option, above. WARNING: This option can be extremely hazardous to the
365health of your pool and should only be used as a last resort.
366.It Fl T
367Specify the txg to use for rollback. Implies
368.Fl FX .
369For more details
370about pool recovery mode, see the
371.Fl X
372option, above. WARNING: This option can be extremely hazardous to the
373health of your pool and should only be used as a last resort.
374.It Fl t
375Used with
376.Sy newpool .
377Specifies that
378.Sy newpool
379is temporary. Temporary pool names last until export. Ensures that
380the original pool name will be used in all label updates and therefore
381is retained upon export.
382Will also set -o cachefile=none when not explicitly specified.
383.El
384.El
385.Sh SEE ALSO
386.Xr zpool-export 8 ,
387.Xr zpool-list 8 ,
388.Xr zpool-status 8
389