Stop pipe buffering from ruining your long-distance disk copies
Backup & Recovery (Rsync/Tar/Dd)
Stop pipe buffering from ruining your long-distance disk copies
🧩 The Challenge
Trying to pipe a tar stream over ssh to a remote drive only to watch your throughput collapse to a crawl is infuriating. Most people don’t realize the default pipe buffer size is often tiny, causing the transfer to choke when latency spikes.
💡 The Fix
Increase the buffer size using pv before sending the data through your ssh pipe. It keeps the flow steady and gives you a progress bar that actually helps you visualize the bottleneck.
tar -cf - /path/to/data | pv -B 128m | ssh user@remote "tar -xf - -C /remote/path"
⚙️ Why It Works
Adding the -B flag forces pv to allocate a much larger buffer in memory, preventing the read/write process from stuttering when the network pipe gets jittery. It essentially creates a massive shock absorber for your data stream.
🚀 Pro-Tip: If you’re on a high-latency link, throw -C lz4 into the tar command to compress the stream on the fly.
Linux Tips & Tricks | © ngelinux.com | 11/28/2026
