远程文件传输rsync-断点续传及增量传输

下面以实例来说明:
  # rsync -vazu -progress cnangel@10.1.6.160:~/works/ ~/works
  v:详细提示
  a:以archive模式操作,复制目录、符号连接,等价于 -rlptgoD 。
  z:压缩
  u:只进行更新,防止本地新文件被重写,注意两者机器的时钟的同时
  -progress:指显示
  以上命令是保持客户机10.1.6.160上的$HOME/works目录和当前机器的$HOME/works目录同
步。
这经常是我们所说的镜像同步就是这么来的,如果断点续传呢?rsync完全可以做到这一点。man手册再次告诉我们:
--partial
By default, rsync will delete any partially transferred file if the transfer is
interrupted. In some circumstances it is more desirable to keep partially transferred
files. Using the --partial option tells rsync to keep the partial file which should
make a subsequent transfer of the rest of the file much faster.

--partial-dir=DIR
A better way to keep partial files than the --partial option is to specify a DIR that
will be used to hold the partial data (instead of writing it out to the destination
file). On the next transfer, rsync will use a file found in this dir as data to
speed up the resumption of the transfer and then delete it after it has served its
purpose.
默认的情况下,当rsync传输中断后,新的rsync传输将删除所有的未完成的残余文件片段,然后开始新的传输。而使用--partial后,将会进行我们所说的断点续传。
值得注意的是-P这个参数是综合了--partial --progress两个参数,所以rsync的断点续传可以用下面的例子来说明:
# rsync -avzP /tmp/bigfile cnangel@10.1.6.160:/tmp/bigfile
另外,还有两个参数也经常用到:
  t:修改次数
  r:递归方式

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值