Home / Solaris 10 / How to recover a destroyed zfs storage pool

How to recover a destroyed zfs storage pool

ZFS has one of the cool features that we can recover the destroyed pool if the zpool disk is not used or removed from the system for other purpose. Once we issue the command to destroy the particular pool, Solaris will put the zpool in destroyed mode and it won’t remove any data from those zpool disks.

Note:Zpool destroy is very dangerous command since it destroys the zpool even if it contains mounted datasets.

So the bottom line is accidentally deleted zpool can be re-imported using the below method.
I am destroying the zpool using destroy command. 
# zpool destroy data_pool

Verifying that pool has been removed from system or not.

# zpool list |grep –i data_pool

Checking the destroyed pools on this system

# zpool import -D
pool: data_pool
id: 9205677892434161971
state: ONLINE (DESTROYED)
action: The pool can be imported using its name or numeric identifier.
config:
data_pool ONLINE
mirror-0 ONLINE
c1t9d0 ONLINE
c2t11d0 ONLINE

Here we are trying to import the destroyed zpool.

# zpool import -D data_pool
# zpool status -x
all pools are healthy

If the above command, may fail, import the zpool forcefully and bring the missing devices online. Go ahead with this, if you have valid replicas in the zpool.

# zpool import -D
pool: data_pool
id: 9205677892434161971
state: ONLINE (DESTROYED)
action: The pool can be imported using its name or numeric identifier.
config:
data_pool ONLINE
c1t9d0 ONLINE
c2t11d0 UNAVAIL

Importing forcefully

# zpool import -Df data_pool
# zpool status -x
pool: data_pool
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: http://www.sun.com/msg/ZFS-8000-2Q
scrub: scrub completed after 0h0m with 0 errors on Thu July 10 15:38:48 2012
config:

NAME STATE READ WRITE CKSUM
data_pool DEGRADED 0 0 0
mirror
c1t9d0 ONLINE 0 0 0
c2t11d0 UNAVAIL 0 37 0 cannot open
errors: No known data errors
# zpool online data_pool c2t11d0
Bringing device c2t11d0 online
# zpool status -x
all pools are healthy
So before importing the zpool ,just make sure that disks/luns are visible from OS side. By doing that you no need to import the zpool forcefully.

Thank for reading this article. please leave a comment if you have any doubt.I will get back you .

VMTURBO-CLOUD-CAPACITY

Leave a Reply

Your email address will not be published. Required fields are marked *