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