[SOLVED] Migrating Proxmox LXC containers with low downtime

yarii

Renowned Member
Mar 24, 2014
145
8
83
Hellou guys,
I have a big container >500GB whitch I cannot shutdown for a long time.

I use ZFS and my script for migrating is:

I. zfs snapshot zfs-vps2/subvol-105-disk-1@snap1
II. zfs send zfs-vps2/subvol-105-disk-1@snap1 | ssh HOST2 zfs receive zfs-vps1/subvol-105-disk-1
III. pct shutdown 105
IV. zfs snapshot zfs-vps2/subvol-105-disk-1@snap2
V. zfs send -I zfs-vps2/subvol-105-disk-1@snap1 zfs-vps2/subvol-105-disk-1@snap2 | ssh HOST2 zfs receive zfs-vps1/subvol-105-disk-1
VI. ssh HOST2 pct start 105


Steps I-IV goes OK but the last one gets me an error:
cannot receive incremental stream: destination zfs-vps1/subvol-105-disk-1 has been modified

I suspect ZFS automounting for that. How to modify my script to works as I need?
(I copied LXC configurations files earlier).
 
Hi,

I will use pve-zsync insted of custom script. For sure is more reliable; ). Also you can use pve-zsync for the first time using a bandwidth limit that is ok for your lan. Then as the time to migrate is closer, you can repeat pve-zsync, so at the moment of migration(with your CT down) you will transfer a minimum size data over the network.
Using this steps you will have a minimum downtime.
 
Also, if you're running zfs auto snapshot on the receiving end, you need disable snapshots for the receiving filesystem on HOST2 while the first send is in progress:
Code:
zfs set com.sun:auto-snapshot=false zfs-vps1/subvol-105-disk-1
After step V, re-enable snapshots on the receiving end:
Code:
zfs inherit com.sun:auto-snapshot zfs-vps1/subvol-105-disk-1
 
  • Like
Reactions: yarii
Also, if you're running zfs auto snapshot on the receiving end, you need disable snapshots for the receiving filesystem on HOST2 while the first send is in progress:
Code:
zfs set com.sun:auto-snapshot=false zfs-vps1/subvol-105-disk-1
After step V, re-enable snapshots on the receiving end:
Code:
zfs inherit com.sun:auto-snapshot zfs-vps1/subvol-105-disk-1

I did:
zfs set canmount=off zfs-vps1/subvol-105-disk-1

And after V:
zfs set canmount=on zfs-vps1/subvol-105-disk-1

That helped for me. Thanks.
 

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!