Recover a zpool after it’s been exported, given that devices have not been reallocated

solariszfszpool

I had a zpool we'll call 'testpool'.

testpool had 3 devices included in it, and a single zfs called 'test'.

I needed to move 'test' to a new, smaller pool. I wanted to name the new pool the same name 'testpool'.

Basically did the following.

zfs send testpool@backup > /tmp/test-dump
zpool export -f testpool
zpool create -f testpool newdevice
zfs receive -F testpool < /tmp/test-dump

Unfortunately I found out that the testpool@backup snapshot was the wrong snapshot. Too old. I have yet to reallocate the three devices that were in the OLD testpool. (None of these 3 devices are 'newdevice', they are a separate 3.)

Is there any way I can recover data in those devices? I'm thinking since I named the new, smaller pool the same as the old zpool, I'm pretty much SOL. But if not, that would be nice to know.

Edit: More info

I did a 'zpool import' and got this.

bash-3.00# zpool import
  pool: testpool
    id: 14781458723915654709
 state: ONLINE 
action: The pool can be imported using its name or numeric identifier.
config:

    testpool    ONLINE
      c5t8d0    ONLINE
      c5t9d0    ONLINE
      c5t10d0   ONLINE

So I'm guessing I just need the syntax to import this zpool using its numeric identifier, while giving it a new name.

S.

Best Answer

Yes. You can run zpool import with no arguments, and it will identify the available pools for you.

Asssuming the devices from the old testpool are still there, you will see the "old" testpool, and alongside it a GUID for the pool.

Once you have that pools GUID, you can do zpool import $id oldtestpool. After the pool is imported, you can change the mountpoints so they don't overlap with the new testpool's mountpoints.