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

Posted on in Categories , , , , , , , , last updated April 6, 2017

I run a backup script called /root/ 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.

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/
# rsync -av --delete --numeric-ids --relative --delete-excluded \
--bwlimit=10000 \
/var/www/html [email protected]:/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:

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

7 comment

  1. 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


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

      1. [email protected] says:

        @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.

Comments are closed.