Bandwidth Limiting Rsync on a Netgear ReadyNAS
A number of our clients dump backups to a Netgear ReadyNAS and then replicate the contents of that share to another offsite ReadyNAS using rsync. A problem we recently encountered was the replication was consuming most of the bandwidth when rsync was running. We could have done traffic shaping or QoS to resolve the issue, but instead we decided to solve this within the ReadyNAS itself.
In this given scenario we're dumping backups to the rsync server. Replication is initiated from the rsync client, which is in a satellite office.
We will be limiting the bandwidth on the rsync server side, which will require us to have ssh access to the server unit.
First, I had to enable SSH access by installing the add-on. This was as simple as downloading the EnableRootSSH add-on from http://www.readynas.com/addons, then uploading and installing it right through the web UI. It will require a reboot to get it started.
After the reboot, ssh to the device and login as root.
Once logged in, you must edit the rsync deamon configuration file by typing "vi /etc/default/rsync."
Change the line that reads RSYNC_OPTS='' to RSYNC_OPTS='--bwlimit=X' where X is the amount in kbytes.
1 mbit = 128 kbytes (ie. I want to limit it to 25 mbit, so I’ll input 3200 as X (25*128))
Restart the service or reboot the NAS for the changes to take effect.
In the graph below, you will see at 2:05pm & 2:15pm I started replication and bandwidth usage quickly shot up to ~45k kbit/s. At 2:30pm, I applied the above change and you will see it levels out somewhere around 32k kbit/s.