• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Limit/throttle rsync transfer speed in Linux

by admin

If you use the rsync utility to keep your backups synchronized between your servers or with a local machine, you might want to prevent the script from using too much bandwidth. However, rsync makes a lot of network I/O. The point of limiting bandwidth is to make sure your backup scripts don’t clog up the network connection.

Naturally, limiting the amount of bandwidth your backups are using is going to make them happen more slowly, but if you can deal with that, this is the way to do it.

Here is a normal rsync command:

$ rsync –avz -e 'ssh' /path/to/source user@remotehost:/path/to/dest/

What you’ll want to do is use the –bwlimit parameter with a KB/second value, like this:

$ rsync –bwlimit=[kb/second] –avz -e 'ssh' /path/to/source user@remotehost:/path/to/dest/

So if you wanted to limit transfer to around 10000KB/s (9.7MB/s), enter:

$ rsync –bwlimit=10000 –avz -e 'ssh' /path/to/source user@remotehost:/path/to/dest/

Here is a real world example:

rsync –bwlimit=10000 –avz -e 'ssh' /backup/ root@192.168.0.51:/backup/

Here, rsync will be throttled to a bandwidth of 10000kb/second or 9.7MB/s approximately.

Using trickle

There is an alternative to the -bwlimit option. You can also use the “trickle” command to limit the bandwidth of any application you run. The syntax of trickle command is:

$ trickle -u|-d [uploadLimit|downloadLimit] [app]

Here,
-u uploadLimit -> limits the upload bandwidth
-d downloadLimit -> limits the download bandwidth
app -> is the application you want to limit bandwidth for e.g. rsync.

So in our case, we will limit the rsync command bandwidth usage to 0000kb/second using the below commands:

$ trickle -s -u 10000 -d 10000 rsync –avz -e 'ssh' /backup/ root@192.168.0.51:/backup/

Filed Under: Linux

Some more articles you might also be interested in …

  1. foreman Command Examples in Linux
  2. CentOS/RHEL : Unmounting a Windows Share Fails – “device is busy”
  3. How to Start, Stop and Restart Zimbra Service
  4. traceroute: command not found
  5. CentOS / RHEL 5 : How to use the faillog command to track failed login attempts
  6. pacman –upgrade Command Examples in Linux
  7. Linux OS Service ‘anacron’
  8. guake: command not found
  9. lvm Command Examples in Linux
  10. nmcli: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright