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