当试图通过网络将稀疏VM映像文件从一个KVM管理程序复制到另一个KVM管理程序时,我看到以下行为:
来源:
[root@kvm1 thin_images]# ls -lhs
total 2.6G
1.4G -rw-------. 1 root root 8.0G Jul 20 11:10 centos6-8g.img
1.3G -rw-------. 1 root root 8.0G Jul 20 10:50 debian7-8g.img目的地:
[root@kvm2 thin_images]# ls -lhs
total 11G
4.8G -rw-------. 1 root root 8.0G Jul 20 11:10 centos6-8g.img
6.2G -rw-------. 1 root root 8.0G Jul 20 10:50 debian7-8g.img如您所见,CentOS映像的稀疏文件现在是4.8G,而不是1.4G。对于Debian图像,它从1.3G增长到6.2G。
我尝试通过网络复制的方法包括肮脏的数控焦油管和使用--稀疏和--内置选项进行rsync.。管理程序没有在新的Linux内核上使用寻觅_bsdtar的空穴功能,也没有bsdtar本身。
对这种行为有什么解释吗?在通过网络复制目标稀疏文件之后,目标稀疏文件是否可以保持与原始稀疏文件相同的大小?
其他信息:
[root@kvm1 thin_images]# uname -a
Linux kvm1 2.6.32-504.23.4.el6.x86_64 #1 SMP Tue Jun 9 20:57:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@kvm1 thin_images]# yum list installed rsync tar nc
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: centos-mirror.jchost.net
* extras: mirror.spro.net
* updates: mirror.es.its.nyu.edu
Installed Packages
nc.x86_64 1.84-22.el6 @base
rsync.x86_64 3.0.6-12.el6 @anaconda-CentOS-201410241409.x86_64/6.6
tar.x86_64 2:1.23-11.el6 @anaconda-CentOS-201410241409.x86_64/6.6发布于 2015-09-09 09:18:02
rsync等通常只会在一定字节数之后才会稀疏,并且通常只在块大小(需要读取源代码,但我记得基于它的块大小)来决定使用稀疏方法的方式上。因此,在其中写入单个字节的块将被复制和写入,因此分配的块大小与仅对该字节的搜索和对其余字节的搜索进行比较。在原始文件(S)中,它将是512字节的块大小,但是transfers/etc (为了优化)将是64k块大小。因此,64 of中的单个字节集将得到一个64 of的写入磁盘,而不是试图对该“块”进行稀疏化。
即使在这些映像的本地文件系统上执行rsync,您也可能看到类似的结果。
看一看这些关于职位调动的内容:https://rwmj.wordpress.com/2010/10/19/tip-making-a-disk-image-sparse/和http://blog.easter-eggs.org/index.php/post/2013/09/24/Convert-an-unsparse-vm-image-to-sparse-vm-image --您给出的链接中的建议随后将适用于:
https://serverfault.com/questions/707786
复制相似问题