On 2012-12-29 15:00 +0200, Alex Lyakas wrote:
There is no special repo, but you may want, in addition to the patch
you mentioned, apply this one as well:
https://patchwork.kernel.org/patch/1604391/
Very useful! Somehow a few lines got wrapped though.
quoted
Is there a way for me to directly change the received_uuid of
/mnt/bak/.snap to make it identical to the UUID of /.snap? This looks
like the easiest way if I only need to do it once.
There is no implemented way, but since you debugged this far, you can
put up some code that sends BTRFS_IOC_SET_RECEIVED_SUBVOL, which is
the one setting the received_uuid (and some other small stuff, please
check the kernel code for it).
Ah, BTRFS_IOC_SET_RECEIVED_SUBVOL. Thanks for pointing me in the right
direction. After some hacking, it worked without eating my data... These
are the two commands to run before the failing one:
btrfs subvolume snapshot /mnt/bak/.snap /mnt/bak/.snap-mangled
uu / .snap /mnt/bak/.snap-mangled
... where uu is my crude little received_uuid and stransid display and
adjustment tool. I've attached its source.
Would be cool if someone modified btrfs send/receive to handle this use
case automatically, but it's too difficult for me.