Given the situation explained below, it appears I can fix my btrfs send 
datastream by updating the UUID and CTRANSID of alternate_sv2. Specifically, 
Command 1 TLV 1 and 2, or Command 2 TLV 1 and 2. The CRC32 would also be 
updated.

This would make incremental btrfs "send" backups markedly more useful because 
it allows me to erase intermediate backups after a time.

It's trivial to write a program to do this, so I plan to start testing next 
week unless anyone has concerns.



btrfs subvolume snapshot -r real v1
#later...
btrfs subvolume snapshot -r real v2
#later...
btrfs subvolume snapshot -r real v3

btrfs send -f sv1 v1
btrfs send -f sv2 v2 -p v1
btrfs send -f sv3 v3 -p v2

btrfs subvolume delete v?

btrfs receive -vf sv1 .
btrfs receive -vf sv2 .
btrfs subvolume delete v1
btrfs send -f alternate_sv2 v2
btrfs subvolume delete v?


#Scenario 1 should work (and does)
btrfs receive -vf sv1 .
btrfs receive -vf sv2 .
btrfs receive -vf sv3 .


#Scenario 2 should work (but doesn't)
btrfs receive -vf alternate_sv2 .
btrfs receive -vf sv3 .         # "ERROR: could not find parent subvolume"



To solve the problem, I plan to update the data for TLV ops 1 and 2 in 
alternate_sv2.

Packet: op 2    SNAPSHOT        length 46       crc32 36A251CC
   TLV: op F    PATH            length 2        "v2"
   TLV: op 1    UUID            length 10       81A4010723F85C4E996371EE73A413AC
   TLV: op 2    CTRANSID        length 8        EB01000000000000
   TLV: op 14   CLONE_UUID      length 10       FA2E1AEC25CFD540B7CA404D6584F4AA
   TLV: op 15   CLONE_CTRANSID  length 8        EA01000000000000

It also appears possible to combine two data streams without "btrfs receive", 
but that's more complicated.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to