VZ migrate speed-up rsync if you have enought space

mik

New Member
Apr 19, 2012
2
0
1
When you migrate an openVZ container the files are deleted from the source node, so when you migrate back the CT you have to copy again all the files, you do not sync them, because the old copy was deleted, so it can be slow.

If you have enought space you can keep a copy of the CT for each node by modifying some files.
Warning : it will be active for all the CT, so you have to have enought space to maintain a copy of the CT on each node.

So on each node modify the following files :

/usr/share/perl5/PVE/AbstractMigrate.pm
@ line 111 replace
Code:
my @rsync_opts = ('-aH', '--delete', '--numeric-ids');
by
Code:
my @rsync_opts = ('-aH', '--numeric-ids');

/usr/share/perl5/PVE/OpenVZMigrate.pm
comment line 300 to 305
Code:
#if (!$self->{shared}){
#      #destroy local container data
#      $self->log('info',"removing container files on local node"); 
#      my $cmd = [ 'rm', '-rf', $self->{privatedir} ]; 
#      $self->cmd_logerr($cmd);
#}
then restart the node.

You have to do these manipulations on each node of your proxmox cluster.

If you want to test it before restart you can do a migration from the shell :
Code:
pvectl migrate CTID PROXMOXNODE
then check the private repository you will see that the files of CT are still present.

I tested this on three nodes with no problem, but not in production yet.
 
then restart the node.

This part doesnt appeal to me, so my question is this: which pve service do I have to restart so that the web interface parses the perl libraries and is that safe to do (i.e. no VM interruption / loss of cluster connectivity)?
 

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!