Sparse rootfs file aware LXC migration?

chronos

Active Member
Apr 11, 2009
55
2
28
Hello all,
I have a question related to migration of new LXC containers presented in Proxmox 4.x.
If I create LXC container with 300 GB allocated size for rootfs and start migration between two Proxmox VE 4.1 servers then proxmox will copy all 300 GB even if real size is just 1 GB.
In current state even with gigabit network rootfs is copied with speed 50 MB/s and entire transfer of 300 GB will take 1 hour and 40 minutes.
Is there a way to fix this so only 1 GB of real data will be copied? rsync should support sparse files with --sparse option.
 
It seems that rsync was really executed with sparse option and target file is store also as sparse.
Question is why it transfers entire file even if only small part of it is really used.

/usr/bin/rsync --progress --sparse --whole-file /var/lib/vz/images/116/vm-116-disk-1.raw root@10.145.64.19:/var/lib/vz/images/116/vm-116-disk-1.raw
 
I found confirmation that rsync sparse option really transfers whole file and final file is sparse.
But there is another way to transfer sparse file. First initialize file on target location using with same size as oriignal file:
truncate -s SIZE /var/lib/vz/images/123/vm-123-disk-1.raw
and then execute:
rsync --progress --inplace /var/lib/vz/images/123/vm-123-disk-1.raw
This will transfer only differences. Although it is much faster then with --sparse option, it is also more CPU intensive on both source and destination host. The file was reported to be transfered with speed 180 MB/s even through gigabit network. In case if --sparse option transfer speed was just 50 MB/s. Also before any progress was displayed and transfer started there was several seconds delay and CPU was 100% used on target host. Probably checking content of target empty sparse file.

See this answer http://unix.stackexchange.com/a/120094
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!