可以使用 zpool import –D 命令恢复已销毁的存储池。例如:
# zpool destroy tank # zpool import -D pool: tank id: 5154272182900538157 state: ONLINE (DESTROYED) action: The pool can be imported using its name or numeric identifier. config: tank ONLINE mirror-0 ONLINE c1t0d0 ONLINE c1t1d0 ONLINE
在此 zpool import 输出中,根据以下状态信息,可以确定池 tank 为已销毁的池:
state: ONLINE (DESTROYED)
要恢复已销毁的池,请再次执行 zpool import –D 命令,并指定要恢复的池。例如:
# zpool import -D tank
# zpool status tank
pool: tank
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
tank ONLINE
mirror-0 ONLINE
c1t0d0 ONLINE
c1t1d0 ONLINE
errors: No known data errors即使已销毁的池中的某个设备不可用,您仍可以通过加入 –f 选项来恢复已销毁的池。在此情况下,请导入已降级的池,然后尝试修复设备故障。例如:
# zpool destroy dozer
# zpool import -D
pool: dozer
id: 4107023015970708695
state: DEGRADED (DESTROYED)
status: One or more devices are unavailable.
action: The pool can be imported despite missing or damaged devices. The
fault tolerance of the pool may be compromised if imported.
config:
dozer DEGRADED
raidz2-0 DEGRADED
c8t0d0 ONLINE
c8t1d0 ONLINE
c8t2d0 ONLINE
c8t3d0 UNAVAIL cannot open
c8t4d0 ONLINE
device details:
c8t3d0 UNAVAIL cannot open
status: ZFS detected errors on this device.
The device was missing.
# zpool import -Df dozer
# zpool status -x
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
raidz2-0 DEGRADED 0 0 0
c8t0d0 ONLINE 0 0 0
c8t1d0 ONLINE 0 0 0
c8t2d0 ONLINE 0 0 0
4881130428504041127 UNAVAIL 0 0 0
c8t4d0 ONLINE 0 0 0
errors: No known data errors
# zpool online dozer c8t4d0
# zpool status -x
all pools are healthy