rsysncコマンドで帯域制限。bwlimitオプション。




投稿日:

rsyncコマンドでは、一言でいうと同期ツール。フォルダ間の同期をしてくれます。

ローカルマシン、リモートホストどちらでも対応可能です。

今回、リモートホストへ、バックアップをする用途で使用しましたが、帯域制限の壁に当たりました。
うちのネットワークの帯域制限が低い為に、途中でエラーを起こしてしまいます。

また、ローカルマシン内で違うパスへの同期に使用する際でもエラーになることがあります。
よくあるのが物理的には違うHDDだったりする場合や、パーティションが別の場合です。

そんなときに便利なのがbwlimitオプション。

 

  • manページ参照

–bwlimit=KBPS          limit I/O bandwidth; KBytes per second

–bwlimit=KBPS
This option allows you to specify a maximum transfer
rate in kilobytes
per second. This option is most effective when using
rsync with  large
files  (several  megabytes  and up). Due to the nature
of rsync trans-
fers, blocks of data are sent, then if rsync determines
the  transfer
was  too  fast,  it  will wait before sending the next
data block. The
result is an average transfer rate equaling  the
specified  limit.  A
value of zero specifies no limit.

 

  • 使用例

rsync -av –bwlimit=1250  –timeout=600 /home/foo /test/test

単位がメガでなくキロなので注意。

30Mbps =  3750KBps
10Mbps =  1250KBps
1Mbps = 125KBps

これで安全に確実に同期ができるようになって、rsyncでのエラーはかなり減りました。

 




  • 参考

rsyncのbwlimitオプション – まつぼ x Web
http://matsu.teraren.com/blog/2010/10/28/rsync-bwlimit/

Command Technica:はじめてrsyncを使う方が知っておきたい6つのルール (1/2) – ITmedia エンタープライズ
http://www.itmedia.co.jp/enterprise/articles/0804/21/news013.html






コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください