Rsync - Limit Upload

Today my father asked me to send him some things. There were 10 files of approximately 250MB each; too much work to send via email, 2.5GB would exceed my limit on Dropbox, and there was no Google Drive for Linux yet (only via web, meh). The simplest solution was to store them on my server.

My first attempt was to send them via scp:

scp -r files/

However, the transfer was at maximum speed, causing the internet to become very slow. I could limit the speed using iptables, Trickle, pv, and even directly through the router, but these alternatives are not very practical.

To my delight, reading the scp manual, I noticed that its developers had already implemented the option to limit the bandwidth:

-l ;limit: Limits the used bandwidth, specified in Kbit/s.

So all I needed to do was use the following command to copy the files with a limited speed of 45 Kbyte/s (360 Kbit/s):

scp -l 360 -r files/

But even before testing this option, I remembered rsync, which has the advantage of allowing me to interrupt the upload and resume it later and to synchronize the files if I change something later on.
Moreover, it also has an option to limit the upload speed:

rsync -hrPvpt --bwlimit=45 -e ssh files/

Don’t forget to limit the torrents as well 😉.

Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus