ZFS Data recovery from a detached drive.

Hello!

I am at my wits' end. I was trying to boot from a mirror and had some problems. I used zpool detach for the drive that the system could boot with. I Tried a some things but due to my stupidity at some point I used dd to clone the drive that could boot to the one I was trying to boot with. Long story short now I have no way to get zroot back. I have the data intact but can't interact with it.

zpool import shows no pools even with flags like -F -f -D and such.

I have no other backup so I am trying to access my data by booting from a memstick usb drive. If anyone has any suggestions I would be thankfull.
 
zdb -l /dev/nda0p4 shows the label and the pool's stracture seems to be correct. However, when I try to import with zpool import -f "pool-guid" or "guid" I still get no pools available to import. I don't think I did anything to the drive after detaching it so I find it weird. If anybody could help I would really appreciate it!
 
What does zpool import -d /dev/nda0p4 tell you? It might get confused because you dd(1)'ed the disks and now the ZFS meta data is exactly the same on both drives. Can you remove one of them?
 
What does zpool import -d /dev/nda0p4 tell you? It might get confused because you dd(1)'ed the disks and now the ZFS meta data is exactly the same on both drives. Can you remove one of them?
Hello SirDice!

I tried the command with the original only as well as with the dded one only and in both cases got "no pools available to import".

I tried dding the partitions one by one instead of the whole disk (after a clean installation) and the pool is shown now but it is " FAULTED corrupted data". With this when I run that command I get that there is no such pool available.

If I try to do it by disk-id instead I get "no pools available to import" as I do with the original.

Also I want to express my gratitude since your posts have really helped me at times!
 
Yes, I tried installing freebsd in it which wiped the full disk dd and used dd for each partition seperatly. I think the pool that is shown is the one from the reinstallation and by corrupt it means what I did with dd. Although I am not sure. Do records of pools also exist in memstick installations?
 
I am looking into the issue since yesterday. As it happened, I was running tests in a VM when your second post was published. So far I was unable to determine how to import from a mirror detach drive without a pool.

I found the following links, but they don't seem to offer a viable solution to the issue at hand. Have a look, perhaps I overlooked something. :


 
I'm fairly sure your data is gone. You forgot the first, and most important, rule of data recovery; DO NOT WRITE ANYTHING to the disk you're trying to recover.
 
  • Like
Reactions: cy@
I didn't write anything to it. The disk that I used to boot from was only detached from the pool. The other one I rewrote a few times. But it is true I messed up. I shouldn't have dded the disk.

I will check that post first thing tomorrow.

Thank you for your help SirDice and T-Daemon. It means a lot.
 
I shouldn't have dded the disk.
It started with detaching the disk, that broke the mirror. A zpool mirror only works on the ZFS data (typically on a freebsd-zfs partition), it does not mirror the boot partitions (efi and/or freebsd-boot). It also doesn't copy or mirror the partition tables of the disks.
Code:
DESCRIPTION
     Detaches device from a mirror.  The operation is refused if there are no
     other valid replicas of the data.  If device may be re-added to the pool
     later on then consider the zpool offline command instead.
zpool-detach(8)
 
You are right, the fact that I didn't read the documentation about that is the reason this happened. I tried a few things from the linked posts but nothing worked. Decided to start fresh. Thankfully I didn't have any files I needed in it. Just my jails but I can remake the ones I don't have exported. Thank you for everything! If you want to close the thread go ahead.
 
Back
Top