zfs import from old TXG

Volodymyr Kostyrko arcade at b1t.name
Wed Aug 23 18:38:14 UTC 2017


Chris Ross wrote:
>
>> On Aug 13, 2017, at 09:54, Volodymyr Kostyrko <arcade at b1t.name> wrote:
>>
>> Paul Kraus wrote:
>>
>>> Using zdb you can examine the TXGs and there is a way to force an import to a certain TXG (at least under Illumos there is, I assume the FBSD ZFS code is the same). I do not remember the specific procedure, but it went by on one of the ZFS mailing lists a few years ago. The goal at the time was not to deal with a changed pool configuration but a series of writes that corrupted something (possibly due to a feature being turned on at a certain point in time). You would lose all data written after the TXG you force the import to.
>>>
>>> Looking at the manpages for zpool and zdb, it looks like doing this has gotten easier with `zdb -e -F` … operate on exported pool and rollback TXG until the pool is importable … but I’m sure there are limits :-)
>>
>> That's -T, it was intentionally left undocumented.
>>
>> /usr/src/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c /starting txg
>
>   Looking back at this, and trying to recover some data without multi-day clean/restore cycles.  I want to import my pool to an earlier txg.  I used zfs history to log the actions, and am trying to use “zpool import -N [-F] -T 7428 tank”.  With or without a -F argument, I get:
>
> cannot import 'tank': one or more devices is currently unavailable
>
>   However, zpool import shows all of its devices ONLINE, and I only exported it a short while ago.  Is there something I’m missing that I can provide to proceed with effectively importing an earlier state of this pool?

Available transactions can be listed with:

zdb -ul <device>

I can't remember how long it takes to overwrite old transactions but if 
the pool was imported more then a few hours after the disk was added 
older transactions would already be overwritten...

PS: If not minutes.

-- 
Sphinx of black quartz judge my vow.



More information about the freebsd-fs mailing list