ZFS ZFS file allocation table

Hi,

I was experimenting moving ZFS disks from a FreeBSD to a Linux PC and the other way around.

During one of many tests, I exported a disk (single ZFS drive) on Ubuntu and attached to FreeBSD.
FreeBSD saw the disk, I could see it in dmesg, but zpool import didn't do anything.

I tried zpool create test da3 thinking it would give me an error but the command actually worked and it overwrote the original partition.

I know thefiles are still there, given that zfs create took only a couple of seconds and the disk is half full (6TB).

Is there a way to recover the files inside the old structure or the old structure itself?

Thank you in advance!
 
was ubuntu using it as /dev/sda or as /dev/sdaX (did the drive had any partitions ?)
The disk was originally created under FreeBSD with zpool create pool ada2 and then exported and imported on linux, so I don't think it had any partitions, but tbh I didn't check.
 
You probably destroyed your data. With new uberblocks and labels pointing to the new MOS, you won't really be able to get the old one back (there's a slim chance that maybe the old pool's first labels were offset, such as on a partition you made instead of the whole disk).

Sorry to say, zpool create was an incredibly stupid thing to run if you cared about the data.
 
… thinking it would give me an error …

Good thinking.

I do see protection against casual mistakes:

Code:
root@mowa219-gjp4-8570p-freebsd:~ # zpool create test /dev/da2p1
root@mowa219-gjp4-8570p-freebsd:~ # lsblk da2
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da2              2:54  965M GPT                                               - -
  <FREE>         -:-   1.0M -                                                 - -
  da2p1          2:44  964M freebsd-zfs                             gpt/FreeBSD <ZFS>
root@mowa219-gjp4-8570p-freebsd:~ # zpool export test
root@mowa219-gjp4-8570p-freebsd:~ # zpool create oops /dev/da2    
invalid vdev specification
use '-f' to override the following errors:
/dev/da2 is part of exported pool 'test'
root@mowa219-gjp4-8570p-freebsd:~ # zpool create oops /dev/da2p1
invalid vdev specification
use '-f' to override the following errors:
/dev/da2p1 is part of exported pool 'test'
root@mowa219-gjp4-8570p-freebsd:~ # man zpool-labelclear  
root@mowa219-gjp4-8570p-freebsd:~ # zpool labelclear /dev/da2
use '-f' to override the following error:
/dev/da2 is a member of exported pool "test"
root@mowa219-gjp4-8570p-freebsd:~ # zpool import test && zpool destroy test
root@mowa219-gjp4-8570p-freebsd:~ # zpool labelclear /dev/da2
root@mowa219-gjp4-8570p-freebsd:~ #

(I assume that you did not add -f to force creation.)



… overwrote …

This can't help to recover data, but the image at <https://forums.freebsd.org/posts/547434> should help you to visualise the four areas where labels would have been written.
 
Back
Top