Skip to content

Instantly share code, notes, and snippets.

@drolfe
Last active October 30, 2021 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save drolfe/a43bc7a0f7afaa91e4f1 to your computer and use it in GitHub Desktop.
Save drolfe/a43bc7a0f7afaa91e4f1 to your computer and use it in GitHub Desktop.
Solusvm kvm migration 2-minute outage
#New host
#Create a bank LV the same size as the source
lvcreate -L 400G -n kvm133_img vm_vg
#Old Host
#Creat a snapshot to stop any new data being written to the 400G LV, All changes get written to the snap lv now
lvcreate --snapshot -L10G -n kvm133-snap /dev/4tb_raid_vg/kvm133_img
#Copy the data from the source lv to the new hosts blank lv
dd if=/dev/4tb_raid_vg/kvm133_img bs=1M | pv -ptrb -s 400G | ssh root@192.168.10.207 'dd of=/dev/vm_vg/kvm133_img'
# Relax and have a drink
# Wait
# Tap your foot and wait some more
#Shut down vm the on the old host
virsh shutdown kvm133
#Then lastly Sync the data that was changed in the vps while the 400g was copied, should only take 1 minute
lvmsync /dev/4tb_raid_vg/kvm133-snap root@192.168.10.207:/dev/vm_vg/kvm133_img
#Solusvm master
/scripts/vm-migrate 77 8
#Then boot the vm up on the new node, don't forget to remove the source LV once your sure everything went well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment