Solved How to access data from the failed boot ZFS disk?

I have the following problem:

During update my system PC-BSD 10 failed to boot. It was testing system installed on VMWARE (but I think that the same problem can happen on any system).

I installed another system and connected the failed disk image as the 2nd drive to copy my data (I can't do zfs export).

I see the failed disk as 'unmounted'; the problem is that both: my new system and the old one have the pool name 'tank' and I do not know how to mount my data partition to access data.
 
See zpool(8) for more details on how to import by ID instead of pool name. Something like zpool import -a should show the ID and zpool import -o altroot=/mnt <pool_id> would import it but mount everything at /mnt.
 
Thank you for your help; I think that import by the pool ID should work.
The only problem is that I cannot find the pool ID: zpool import -a shows nothing for me.
 
I partially resolved my issue.

I wanted to connect an existing ZFS pool that was not exported, to the new FreeBSD system that has the same pool name (e.g. 'tank').

To do this I used the pool ID as it was recommended by junovitch (see above, thanks for this).

Unfortunately I couldn't find this ID by running zpool import -a; this command shows only exported pools and I couldn't find the alternative way to identify this ID. Fortunately I could run my system in the single user mode and could get this number.

Then I run the following commands:
zpool import -N 1556305904951068215 saved
zpool export saved
zpool import -o altroot=/mnt/old saved


Probably, I should have omitted '-N' and put 'altroot...' to the 1st command but without the new pool name ('saved' for me) it did not work.

I still worry that in the case the system becomes non-bootable I do not know the way to connect the data drive to a working FreeBSD system and to get access to its data as it can be done with NTFS or FAT drives on Windows.

Now the problem is to identify the ID. Don't anybody knows how to do this? We have 2 drive system: 1st drive has working FreeBSD with ZFS 'tank', the 2nd drive has non-working FreeBSD with non-exported 'tank'.
 
OK, good deal on getting the pool imported. I thought I remember that syntax showing all pools including ones where it can import because of that name conflict. It had been a while since I had a conflicting name issue. Does zdb -l /dev/<adaXpX> show the GUID for you? If that works that might answer the case of identifying the ID when the original machine is not bootable.
 
Now I received a positive result by using recommended:
zdb -l /dev2s1a | grep pool_guid.
As an imported disk I used vmware image that was just a previously saved version of the same disk; I had to change the pool_guid of the working system:
zpool reguid tank
only then I could import and mount it:
zpool import -o altroot=/mnt/old1 13293058574584703173 saved1.
For the real hard drive it shouldn't be a problem though.
The used solution is somewhat awkward but it works; I just wonder why doesn't ZFS have a standard way to connect non-exported disk from another system? Or maybe it does have but I do not know it.
Thank you, junovitch, for your help.
 
I only had an issue with duplicate pool names once, when dealing with two systems with a zpool unimaginatively named "zfs". One of the disks had been having SMART errors on the FreeBSD system and I replaced it and had it in the Linux system temporarily for testing. I thought I remembered seeing it in the zpool import output on the Linux system. The fact that it was the Linux system did slip my mind earlier and the output difference might have been a difference in the output between the Linux and FreeBSD ZFS implementations. Glad we at least have a solution.
 
Back
Top