[zfs-discuss] Backing up ZFS metadata

2012-08-24 Thread Scott Aitken
Hi all,

I know the easiest answer to this question is don't do it in the first
place, and if you do, you should have a backup, however I'll ask it
regardless.

Is there a way to backup the ZFS metadata on each member device of a pool
to another device (possibly non-ZFS)?

I have recently read a discusson on this list regarding storing the working
metadata on off-data devices (mirrored I assume).  Is there a way today to
walk, and save, the metadata of an entire pool and save it somewhere?

The main motivation for the question is that I recently ruined a large raidz
pool buy overwriting the start and end of two member disks (and possibly some
data).  I assume that if I could have restored the lost metadata I could
have recovered most of the real data.

Thanks
Scott
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Backing up ZFS metadata

2012-08-24 Thread Sašo Kiselkov
On 08/24/2012 05:13 PM, Scott Aitken wrote:
 Hi all,
 
 I know the easiest answer to this question is don't do it in the first
 place, and if you do, you should have a backup, however I'll ask it
 regardless.
 
 Is there a way to backup the ZFS metadata on each member device of a pool
 to another device (possibly non-ZFS)?
 
 I have recently read a discusson on this list regarding storing the working
 metadata on off-data devices (mirrored I assume).  Is there a way today to
 walk, and save, the metadata of an entire pool and save it somewhere?
 
 The main motivation for the question is that I recently ruined a large raidz
 pool buy overwriting the start and end of two member disks (and possibly some
 data).  I assume that if I could have restored the lost metadata I could
 have recovered most of the real data.

I don't think you've got a technical problem on your hands, so technical
solutions are likely to be of little use. Essentially, you're asking how
to protect your data from yourself. My suggestion: regular off-site backups.

ZFS metadata is already backed up. Labels are quadruple-redundant,
top-level metadata triple and normal metadata double-redundant.

The particular failure mode you had, namely that you directly erased all
labels from the affected devices, can only be protected against by doing
very regular (read: every 30-60s) backups of the first few MB from the
devices that are to be protected. Even so, this only protects you
against accidentally erasing *all* labels on a vdev's leaf devices. If
you only lost a few labels on, e.g. a raidz, you'd have to restore all
labels on all component disks of the raidz, and even so all hell might
break loose (due to inconsistent txg numbers, etc.). Another method
would be to try and reconstruct the label based on other component disk
labels - that might be slightly more workable, but requires a trained
specialist and cannot be done automatically.

Cheers,
--
Saso
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss