1

I am trying btrfs send/receive a 3TB btrfs volume.

When I sent it to another machine over network, it went fine. The speed was like 20-30 MB/s.

However, when the destination disk is directly attached to the source machine, btrfs send fails after sending like 200-250 GB with send ioctl failed with -5: Input/output error. The speed is above 200 Mb/s.

I checked the source filesystem, did btrfs scrub — all good.

I suspect the I/O error has something to do with trying to read the source too fast. So I would like to throttle it down to 20 Mb/s locally and try.

How can it be done?

2
  • 1
    I've come across this too and would like a generic solution to limit the kernel module itself, as opposed to a specific userland process utilising btrfs, either at the interface to the disk, or at the interface from userland to the fs syscalls. It happens for me if I use old HDDs with slow seek times and then try to do a massive amount of simultaneous reads. I think it's a bug in btrfs where it allows and queues up too many requests, and they take too long to fulfill so it goes into read only mode, throws the generic IO error, and you have to remount the array (I've been doing this for years). Commented Jan 2 at 0:48
  • The error message could indicate a hardware problem under heavy load: disk or cables or ... Commented Jan 2 at 16:34

1 Answer 1

1

The btrfs' send/receive commands are normally connected over a pipe |, thus the problem can be resolved with any method that can throttle pipes. I see that the btrbk backup application uses mbuffer to throttle transfer speed for example. Personally, I typically use pv when doing manual btrfs send/receive transfers where I want to limit the transfer speed:

# btrfs send /__snap/__example | pv -L 100M -q | ssh root@remote_host btrfs receive /srv/.

The btrfs send is first piped into pv which limits the speed before piping further to ssh. The pv parameters above are:

  • -L 100M ; or --rate-limit 100M (limit speed to 100 Megabytes/s)
  • -q ; or --quiet (don't print anything)

Alternatively instead of --quiet you could use the other feature of pv which prints a progress bar:

  • -p ; or --progress (Turn the progress bar on)
  • -s 64G ; or --size 64G (Assume the total amount of data to be transferred for calculating percentages and ETAs)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.