ZFS error message questions
dch at skunkwerks.at
Wed Jan 31 21:59:14 UTC 2018
On Wed, 10 Jan 2018, at 09:11, Scott Bennett wrote:
Hopefully somebody replied off-line to get you out of your dilemma, Scott.
If not, at least I hope this is useful to your understanding.
> After running 11.1-STABLE with root on ZFS for a week and a half or so,
> I apparently screwed something up such that the system became unusable while
> trying to enter multi-user mode. It looked like the easiest way to correct
> the mess would be to wipe it out and re-install.
I'm a huge fan of using Boot Environments via sysutils/beadm-devel for this.
Basically your / filesystem lives in zroot/ROOT/a_meaningful_name, except
- have multiple copies / versions
- select one of those at start time
- keep "anything useful" on a dataset that lives outside (zroot/usr/home for example)
so that it stays between environments
- I can build and install from source into a new boot environment
- or try out the next release safely inside there
- have super powers for sysadmins
> However, I wanted to save the home directory tree because there had been
> important changes in it since it had been imported from the 10.3-STABLE system
> with root, /usr/home, and so on on UFS2, so I ran
> zfs send -ReL -I @15dec2017.freshlyinstalled-11.1S-r236620 zrootx/usr/
> home at 28dec2017 > /mnt/bootdisks/usrhome.28dec2017.zfs-send
> which is supposed, as I understand it, to have saved a full replication stream,
> including four snapshots. Now I wish to receive this into the newly
> re-installed system, but here is what happens.
> Script started on Sun Jan 7 00:54:39 2018
> # zfs recv -dv zrootx </mnt/bootdisks/usrhome.28dec2017.zfs-send
> receiving incremental stream of zrootx/usr/home at 16dec2017.post-import-
> from-10.3S into zrootx/usr/home at 16dec2017.post-import-from-10.3S
> cannot receive incremental stream: most recent snapshot of zrootx/usr/
> home does not
> match incremental source
> # exit
Almost - you're not starting from the beginning of the zfs dataset, but a snapshot
partway through, 15dec2017.freshlyinstalled-11.1S-r236620.
As an example if we squint hard and pretend that the dataset is just a simple
array, e.g. dataset [0,1,2,3,4] is the entire dataset and all snapshots, then
you've sent [2,3,4] along, but you still need [0,1] to be able to have all the data,
and also to be able to create a valid dataset you'll need the first few chunks - anything
that hasn't changed in [2,3,4] is only going to exist in the early blocks in [0,1].
If you don't need the earlier snapshots, its sufficient to `zfs send -Lev zrootx/usr/home at 28dec2017 > zrootx_usr_home_28dec2017.zfs`. Just remember that's not recursive so you'll
need to do that for each dataset separately. This is likely to be a lot smaller than the
full set with all intermediary snapshots.
> Script done on Sun Jan 7 00:55:59 2018
> I have two questions at this point.
> 1) What in hell does this apparently undocumented error message mean?
The zfs recv is normally (aka I do this and I hope it's common practice) done with
`zfs recv -Fuvs zroot/usr/home` which will try to rollback (the F) any later
snapshots on the receiving dataset to find the last preceding snapshot that your
[2,3,4] stream needs to link onto - the  snapshot is that predecessor.
So the error is simply saying "I can't find anything to continue on from", as your
destination dataset has no blocks in common at all with the incoming replication
stream, as [0,1] are missing.
> 2) Is there still any way to recover what I need from the saved
> stream? It's a couple of hundred gigabytes in length, so if it's just
> junk now, I'd like to free up the space.
If the original [0,1] are no longer about then this is difficult. I am sure there are
people who can extract the changes from the incomplete zfs stream, but to
my knowledge there's no magic command line tool to do so. I'd love to be
proved wrong, and have something like a .zip or .tar recovery tool that
can work with incomplete streams.
> I think I only need three or four files that have changed since I imported
> /usr/home into 11.1-STABLE from 10.3-STABLE by
> dump 0f - /usr/home>/mnt/bootdisks/usrhome
> on the 10.3-STABLE system, followed by
> cd /usr/home
> restore rDf /mnt/bootdisks/usr/home
Some reference for future BE (boot environment fun) are here:
More information about the freebsd-questions