Throttle The Disk I/O Rate: Limit disk I/O For rsync Tool on Linux and Unix

I run a backup script called /root/backup.sh which runs rsync command. However, rsync makes a lot of disks I/O and network I/O. I would like to reduce both disk and network I/O. My server has 10Mbps server connection with 160GB SATA hard drive. How do I reduce disk I/O so that the entire system does not die or become unresponsive?

This is a well-known issue. There are two methods to control or throttle the disk and network I/O rate under UNIX / Linux while using the rsync command.

ADVERTISEMENTS

How To Keep rsync From Using All Your Bandwidth on Linux/Unix/BSD Server

How To Keep rsync From Using All Your Bandwidth on Linux/Unix/BSD Server

Method # 1: Limit I/O bandwidth using rsync command

The --bwlimit option limit I/O bandwidth. You need to set bandwidth using KBytes per second. For example, limit I/O banwidth to 10000KB/s (9.7MB/s), enter:
# rsync --delete --numeric-ids --relative --delete-excluded --bwlimit=10000 /path/to/source /path/to/dest/
OR
# rsync -av --delete --numeric-ids --relative --delete-excluded \
--bwlimit=10000 \
/var/www/html vivek@server1.cyberciti.biz:/backups

Method # 2: Take control of I/O bandwidth using ionice utility

The ionice command sets the io scheduling class and priority for a program or script. You can totally control disk i/o. See the following article for detailed examples:

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
8 comments… add one
  • anonymous Dec 8, 2011 @ 11:00

    Thanks

  • anonymous Feb 7, 2012 @ 2:05

    Check your grammar…. ionice command provide more control as compare to nice command.

    should read:

    The ‘ionice’ command provide more control as compare to the ‘nice’ command

    r3dk1ng

    • anon Mar 24, 2013 @ 8:55

      redking… it’s as “compared to” not “as compare” to… check your grammar too if you wanna complain :)

      • asdf@asdf.tld Jul 25, 2013 @ 15:33

        @anon, if you’re going to use quotes to illustrate the difference between original and corrective syntax, then you should use the quotes around the same group of words. Let me fix your poor correction to redking.

        Should be “as compared to”, not “as compare to”

        But then again, redking also missed pluralizing of provides.

        Here is the final corrected sentence that both of you screwed up:

        The ionice command provides more control as compared to the nice command.

        You are welcome.

        • LOL Apr 6, 2017 @ 8:24

          Guys!!!!
          Please shut up and fix your own garden any time.

        • RD Jul 21, 2020 @ 11:10

          @ asdf@asdf.tld

          Actually, I believe that punctuation should precede a quotes symbol. So this would be correct:

          Should be, “as compared to,” not, “as compare to.”

          I mention this only because I find the corrections funny. Please feel free to correct my correction of the corrected correction.

  • Michael Mounteney Aug 30, 2012 @ 0:52

    Hilarious ! English as she is spoke.

  • Balu Nov 19, 2012 @ 13:40

    Thank you
    server load due to rsync was driving me mad

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.