Managing ZFS File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: December 2014
 
 

Importing ZFS Storage Pools

After a pool has been identified for import, you can import it by specifying the name of the pool or its numeric identifier as an argument to the zpool import command. For example:

# zpool import tank

If multiple available pools have the same name, you must specify which pool to import by using the numeric identifier. For example:

# zpool import
pool: dozer
id: 2704475622193776801
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

dozer       ONLINE
c1t9d0    ONLINE

pool: dozer
id: 6223921996155991199
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

dozer       ONLINE
c1t8d0    ONLINE
# zpool import dozer
cannot import 'dozer': more than one matching pool
import by numeric ID instead
# zpool import 6223921996155991199

If the pool name conflicts with an existing pool name, you can import the pool under a different name. For example:

# zpool import dozer zeepool

This command imports the exported pool dozer using the new name zeepool. The new pool name is persistent.


Note -  You cannot rename a pool directly. You can only change the name of a pool while exporting and importing a pool.

If the pool was not cleanly exported, ZFS requires the –f flag to prevent users from accidentally importing a pool that is still in use on another system. For example:

# zpool import dozer
cannot import 'dozer': pool may be in use on another system
use '-f' to import anyway
# zpool import -f dozer

Note -  Do not attempt to import a pool that is active on one system to another system. ZFS is not a native cluster, distributed, or parallel file system and cannot provide concurrent access from multiple, different hosts.

Pools can also be imported under an alternate root by using the –R option. For more information on alternate root pools, see Using a ZFS Pool With an Alternate Root Location.

Importing a Pool With a Missing Log Device

By default, a pool with a missing log device cannot be imported. You can use zpool import –m command to force a pool to be imported with a missing log device. For example:

# zpool import dozer
pool: dozer
id: 16216589278751424645
state: UNAVAIL
status: One or more devices are missing from the system.
action: The pool cannot be imported. Attach the missing
devices and try again.
see: http://support.oracle.com/msg/ZFS-8000-6X
config:

dozer              UNAVAIL  missing device
mirror-0         ONLINE
c8t0d0  ONLINE
c8t1d0  ONLINE

device details:

missing-1        UNAVAIL          corrupted data
status: ZFS detected errors on this device.
The device has bad label or disk contents.


Additional devices are known to be part of this pool, though their
exact configuration cannot be determined.

Import the pool with the missing log device. For example:

# zpool import -m dozer
# zpool status dozer
pool: dozer
state: DEGRADED
status: One or more devices are unavailable in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or 'fmadm repaired', or replace the device
with 'zpool replace'.
Run 'zpool status -v' to see device specific details.
scan: none requested
config:

NAME                   STATE     READ  WRITE  CKSUM
dozer                  DEGRADED     0      0      0
   mirror-0            ONLINE       0      0      0
      c8t0d0           ONLINE       0      0      0
      c8t1d0           ONLINE       0      0      0
logs
2189413556875979854    UNAVAIL      0      0      0

errors: No known data errors

After attaching the missing log device, run the zpool clear command to clear the pool errors.

A similar recovery can be attempted with missing mirrored log devices. For example:

# zpool import dozer
The devices below are missing, use '-m' to import the pool anyway:
mirror-1 [log]
c3t3d0
c3t4d0

cannot import 'dozer': one or more devices is currently unavailable
# zpool import -m dozer
# zpool status dozer
pool: dozer
state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
see: https://support.oracle.com/epmos/faces/KmHome?_adf.ctrl-state=10oxbvnj5n_4&_afrLoop=1145647522713
scan: scrub repaired 0 in 0h0m with 0 errors on Fri Oct 15 16:51:39 2010
config:

NAME                   STATE     READ  WRITE  CKSUM
dozer                  DEGRADED     0      0      0
   mirror-0            ONLINE       0      0      0
      c3t1d0           ONLINE       0      0      0
      c3t2d0           ONLINE       0      0      0
   logs
   mirror-1                 UNAVAIL      0     0     0  insufficient replicas
      13514061426445294202  UNAVAIL      0     0     0  was c3t3d0
      16839344638582008929  UNAVAIL      0     0     0  was c3t4d0

After attaching the missing log devices, run the zpool clear command to clear the pool errors.

Importing a Pool in Read-Only Mode

You can import a pool in read-only mode. If a pool is so damaged that it cannot be accessed, this feature might enable you to recover the pool's data. For example:

# zpool import -o readonly=on tank
# zpool scrub tank
cannot scrub tank: pool is read-only

When a pool is imported in read-only mode, the following conditions apply:

  • All file systems and volumes are mounted in read-only mode.

  • Pool transaction processing is disabled. This also means that any pending synchronous writes in the intent log are not played until the pool is imported read-write.

  • Attempts to set a pool property during the read-only import are ignored.

A read-only pool can be set back to read-write mode by exporting and importing the pool. For example:

# zpool export tank
# zpool import tank
# zpool scrub tank

Importing a Pool By a Specific Device Path

The following command imports the pool dpool by identifying one of the pool's specific devices, /dev/dsk/c2t3d0, in this example.

# zpool import -d /dev/dsk/c2t3d0s0 dpool
# zpool status dpool
pool: dpool
state: ONLINE
scan: resilvered 952K in 0h0m with 0 errors on Fri Jun 29 16:22:06 2012
config:

NAME        STATE     READ WRITE CKSUM
dpool       ONLINE       0     0     0
mirror-0    ONLINE       0     0     0
c2t3d0      ONLINE       0     0     0
c2t1d0      ONLINE       0     0     0

Even though this pool is comprised of whole disks, the command must include the specific device's slice identifier.