On Sun, Jan 10, 2021 at 11:34:27AM +0100, wrote: > I'm trying to transfer a btrfs snapshot via the network. > > First attempt: Both NC programs don't exit after the transfer is complete. > When I ctrl-C the sending side, the receiving side exits OK. > > btrfs subvolume delete /mnt/rec/snapshots/* > receive side: > # nc -l -p 6790 | btrfs receive /mnt/rec/snapshots > At subvol 0 > > sending side: > # btrfs send /mnt/send/snapshots/0 | nc -v 127.0.0.1 6790 > At subvol /mnt/send/snapshots/0 > localhost [127.0.0.1] 6790 (hnmp) open
Use -q 15 on the sending side. That will exit after 15 seconds of no activity from the send process. > Second attempt: both nc programs exit ok at snapshot 0,1,2, but snapshot3 > fails halfway, and 4 fails, as 3 is not complete. > receive side: > # nc -l -p 6790 | btrfs receive /mnt/rec/snapshots > At subvol 0 > # nc -l -p 6790 | btrfs receive /mnt/rec/snapshots > At snapshot 1 > # nc -l -p 6790 | btrfs receive /mnt/rec/snapshots > At snapshot 2 > # nc -l -p 6790 | btrfs receive /mnt/rec/snapshots > At snapshot 3 > read(net): Connection reset by peer > ERROR: short read from stream: expected 49183 read 10450 This failed because of a network disconnect. > # nc -l -p 6790 | btrfs receive /mnt/rec/snapshots > At snapshot 4 > ERROR: cannot find parent subvolume > write(stdout): Broken pipe This is expected because the previous one failed. There's no btrfs problem here. You just need better error handling (to retry a failed transfer, for example). Hugo. -- Hugo Mills | How do you become King? You stand in the marketplace hugo@... carfax.org.uk | and announce you're going to tax everyone. If you http://carfax.org.uk/ | get out alive, you're King. PGP: E2AB1DE4 | Harry Harrison