2

I caused a stupid accident in a single-disk ZFS pool, seemingly in the same way as the person in this mailing list thread, i. e., I seem to have overwritten important metadata. Can this be restored from the actual payload, or is there a way to retrieve the payload without the metadata?

Here's what I did, exactly:

  • had a ZFS pool running with a single disk on one machine
  • wanted to migrate it to a new ZFS pool on another machine
  • forgot to zpool export it on the first machine
  • when zpool create complained that the device was in use, I thought "No problem, I just took down the host, it's not in use anymore" and did zpool create -f

What I should have done (as I realised after RTFM) is import instead of create on the new host. Now I have a working zfspool, but the filesystems are gone / invisible.

I tried to reimport the device on the old host, and later tried import -D, but, quite obviously, both didn't work.

2 Answers 2

1

Well first things first I'd get a bit stream copy of the disk before trying anything.

Does a zpool import -D do anything?

If I'm honest I don't think it because the new pool has overwritten all labels, blocks and pointer blocks of the original pool.

1
  • No, import -D doesn't do anything, which is probably not surprising, as I didn't destroy the old pool, I "just" overwrote it. Ouch. Mar 2, 2010 at 12:53
1

The top and bottom 512 kilobytes of the disk/partition contain the labels, which include a listing of the last few uberblocks (for recovery and rollback) and the RAID geometry of the pool (more specifically the vdev the disk was part of). By making a new pool you've almost certainly wiped out the old labels. This means you need to know the exact geometry of the pool (RAID-Z configuration with disk order) and go looking for the uberblocks the hard way.

A zpool create overwrites all labels on a device (that's why you had to add "-f", which essentially means "blame me if all goes wrong"). Since the vdev labels contain the root block pointer (which points to the root block of the entire pool object tree) and the value in this block pointer moves around as new data is added (due to COW semantics), your data was gone

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .