Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Forza <forza@tnonline.net>
To: Cedric.dewijs@eclipso.eu, linux-btrfs@vger.kernel.org
Subject: Re: btrfs send / receive via netcat, fails halfway?
Date: Sun, 10 Jan 2021 12:07:11 +0100	[thread overview]
Message-ID: <68cb868e-d282-ad7b-73e4-b285a45606d3@tnonline.net> (raw)
In-Reply-To: <0440549b7c78763ce787b03341ca5b9f@mail.eclipso.de>



On 2021-01-10 11:34, Cedric.dewijs@eclipso.eu 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
> 
> 
> 
> 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
> # nc -l -p 6790 | btrfs receive /mnt/rec/snapshots
> At snapshot 4
> ERROR: cannot find parent subvolume
> write(stdout): Broken pipe
> 
> sending side:
> # btrfs send  /mnt/send/snapshots/0 | nc -v -c 127.0.0.1 6790
> At subvol /mnt/send/snapshots/0
> localhost [127.0.0.1] 6790 (hnmp) open
> # btrfs send -p /mnt/send/snapshots/0 /mnt/send/snapshots/1 | nc -v -c  127.0.0.1 6790
> At subvol /mnt/send/snapshots/1
> localhost [127.0.0.1] 6790 (hnmp) open
> # btrfs send -p /mnt/send/snapshots/1 /mnt/send/snapshots/2 | nc -v -c  127.0.0.1 6790
> At subvol /mnt/send/snapshots/2
> localhost [127.0.0.1] 6790 (hnmp) open
> # btrfs send -p /mnt/send/snapshots/2 /mnt/send/snapshots/3 | nc -v -c  127.0.0.1 6790
> At subvol /mnt/send/snapshots/3
> localhost [127.0.0.1] 6790 (hnmp) open
> # btrfs send -p /mnt/send/snapshots/3 /mnt/send/snapshots/4 | nc -v -c  127.0.0.1 6790
> At subvol /mnt/send/snapshots/4
> localhost [127.0.0.1] 6790 (hnmp) open
> write(net): Connection reset by peer
> 
> 
> 

Hi,

Haven't used netcat for btrfs send, so I am not sure why you have these 
issues. Have you tried mbuffer instead? This is what I use when I don't 
need to go over ssh.

Mbuffer[1] allows you to specify remote host and port. It also has an 
async buffer so it should be a bit faster too. In fact, it is useful on 
a localhost too, for example when sending snaps to a slower local backup 
media.

Receiving side:
# mbuffer -I port | btrfs receive /mnt/rec/snapshots

Sending side:
# btrfs send /mnt/send/snapshots/0 | mbuffer -O remotehost:port

Good Luck!

//Forza

[1]https://www.maier-komor.de/mbuffer.html






  reply	other threads:[~2021-01-10 11:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 10:34 btrfs send / receive via netcat, fails halfway?  
2021-01-10 11:07 ` Forza [this message]
2021-01-10 11:37 ` Roman Mamedov
2021-01-10 12:38   `  
2021-01-10 11:47 ` Hugo Mills
2021-01-10 13:27   ` Hugo Mills

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68cb868e-d282-ad7b-73e4-b285a45606d3@tnonline.net \
    --to=forza@tnonline.net \
    --cc=Cedric.dewijs@eclipso.eu \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox