远程linux服务器到远程linux服务器大型稀疏文件复制 - 如何?

发布于 2024-08-14 03:56:07 字数 189 浏览 7 评论 0原文

我有两台 CentOS 5.4 服务器,每台服务器上都安装了 VMware Server。

假设我始终对 vmware 虚拟机使用稀疏文件,将虚拟机文件从一台服务器复制到另一台服务器的最可靠、最快速的方法是什么?

虚拟机的文件复制起来很痛苦,因为它们非常大(50 GB),但由于它们是稀疏文件,我认为可以采取一些措施来提高复制速度。

I have two twins CentOS 5.4 servers with VMware Server installed on each.

What is the most reliable and fast method for copying virtual machines files from one server to the other, assuming that I always use sparse file for my vmware virtual machines?

The vm's files are a pain to copy since they are very large (50 GB) but since they are sparse files I think something can be done to improve the speed of the copy.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小…红帽 2024-08-21 03:56:07

如果您想快速复制大量数据,通过 SSH 的 rsync 不适合您。由于运行 rsync 守护进程进行快速一次性复制也有些过分,所以老的 tarnc 可以按如下方式实现这一点。

创建将通过网络提供文件的进程:

tar cSf - /path/to/files | nc -l 5000

请注意,可能需要 tar 很长时间来检查稀疏文件,因此暂时看不到任何进展是正常的。

并在另一端接收包含以下内容的文件:

nc hostname_or_ip 5000 | tar xSf -

或者,如果您想获得所有精彩,请使用 pv 显示进度:

tar cSf - /path/to/files \
   | pv -s `du -sb /path/to/files  | awk '{ print $1 }'` \
   | nc -l 5000

稍等一下,直到您看到 pv报告一些字节已经通过,然后在另一端启动接收器:

nc hostname_or_ip 5000 | pv -btr | tar xSf -

If you want to copy large data quickly, rsync over SSH is not for you. As running an rsync daemon for quick one-shot copying is also overkill, yer olde tar and nc do the trick as follows.

Create the process that will serve the files over network:

tar cSf - /path/to/files | nc -l 5000

Note that it may take tar a long time to examine sparse files, so it's normal to see no progress for a while.

And receive the files with the following at the other end:

nc hostname_or_ip 5000 | tar xSf -

Alternatively, if you want to get all fancy, use pv to display progress:

tar cSf - /path/to/files \
   | pv -s `du -sb /path/to/files  | awk '{ print $1 }'` \
   | nc -l 5000

Wait a little until you see that pv reports that some bytes have passed by, then start the receiver at the other end:

nc hostname_or_ip 5000 | pv -btr | tar xSf -
清旖 2024-08-21 03:56:07

您是否尝试过 rsync 与选项 --sparse (可能通过 ssh)?

来自man rsync

    Try  to  handle  sparse  files  efficiently so they take up less
    space on the destination.  Conflicts with --inplace because it’s
    not possible to overwrite data in a sparse fashion.

Have you tried rsync with the option --sparse(possibly over ssh)?

From man rsync:

    Try  to  handle  sparse  files  efficiently so they take up less
    space on the destination.  Conflicts with --inplace because it’s
    not possible to overwrite data in a sparse fashion.
栖竹 2024-08-21 03:56:07

由于 rsync 复制稀疏文件的速度非常慢,因此我通常使用 tar 而不是 ssh

tar Scjf - my-src-files | ssh [email protected] tar Sxjf - -C /the/target/directory

Since rsync is terribly slow at copying sparse file, I usually resort using tar over ssh :

tar Scjf - my-src-files | ssh [email protected] tar Sxjf - -C /the/target/directory
独孤求败 2024-08-21 03:56:07

您可以查看 http://www.barricane.com/virtsync

(免责声明:我是作者。)

You could have a look at http://www.barricane.com/virtsync

(Disclaimer: I am the author.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文