在工作时,我通过 ssh 连接到公司另一个位置的远程服务器。我通常使用 scp 从我工作的本地 Ubuntu 机器复制文件到远程服务器。
最近,当我复制一个大约 3GB 的文件时,我们远程站点的 VPN 连接中断,导致文件复制中断,此时仅复制了大约 1.5GB 的文件。即使是这个复制也花了很长时间(因为我们的链接速度很慢)。
Linux/Unix 下是否有任何文件复制应用程序(基于 ftp/基于 scp/任何其他独立应用程序)来复制文件,以便在中断时,它们可以从正确的状态开始复制,同时避免从头开始重做整个复制过程?
答案1
检查一下rsync
——正是这样做的。
从手册页中:
Rsync is a fast and extraordinarily versatile file copying tool. It
can copy locally, to/from another host over any remote shell, or
to/from a remote rsync daemon. It offers a large number of options
that control every aspect of its behavior and permit very flexible
specification of the set of files to be copied. It is famous for its
delta-transfer algorithm, which reduces the amount of data sent over
the network by sending only the differences between the source files
and the existing files in the destination. Rsync is widely used for
backups and mirroring and as an improved copy command for everyday use.