KVM--静态迁移
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了KVM--静态迁移相关的知识,希望对你有一定的参考价值。
一、同一宿主机内迁移
[[email protected] ~]# virsh domblklist win7 目标 源 ------------------------------------------------ vda /var/lib/libvirt/images/win7.qcow2 vdb /vm/test1.qcow2 vdc /vm/test2.qcow2 hdb /root/iso/virtio-win.iso [[email protected] ~]# mv /var/lib/libvirt/images/win7.qcow2 /vm [[email protected] ~]# ll /vm/win7.qcow2 -rw------- 1 qemu qemu 10739318784 5月 6 13:57 /vm/win7.qcow2 [[email protected] ~]# virsh edit win7 修改前 <source file='/var/lib/libvirt/images/win7.qcow2'/> 修改后 <source file='/vm/win7.qcow2'/> [[email protected] ~]# virsh start win7 域 win7 已开始
[[email protected] ~]# mkdir /vm [[email protected] ~]# ll /tmp/win7.xml -rw-r--r--. 1 root root 4660 May 12 22:37 /tmp/win7.xml [[email protected] ~]# virsh define /tmp/win7.xml Domain win7 defined from /tmp/win7.xml [[email protected] ~]# virsh list --all Id Name State ---------------------------------------------------- - centos6.7 shut off - centos6.7-1 shut off - centos6.7-2 shut off - win7 shut off
源主机:
[[email protected] ~]# rsync -avSHP /vm/win7.qcow2 [email protected]:/vm/ The authenticity of host '172.16.216.140 (172.16.216.140)' can't be established. ECDSA key fingerprint is 39:5b:63:60:54:62:24:0c:c1:d7:fe:01:0a:ae:35:31. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '172.16.216.140' (ECDSA) to the list of known hosts. [email protected]'s password: sending incremental file list win7.qcow2 10739318784 100% 37.73MB/s 0:04:31 (xfer#1, to-check=0/1) sent 10740629812 bytes received 31 bytes 38428013.75 bytes/sec total size is 10739318784 speedup is 1.00 [[email protected] ~]# virsh dumpxml win7 > /tmp/win7.xml [[email protected] ~]# rsync -avSHP /tmp/win7.xml [email protected]:/tmp [email protected]'s password: sending incremental file list win7.xml 4660 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/1) sent 4736 bytes received 31 bytes 1059.33 bytes/sec total size is 4660 speedup is 0.98
三、不同宿主机之间迁移--使用 virsh migrate命令
源主机
virsh # migrate --domain centos7.1 --desturi qemu+ssh://[email protected]/system --offline --persistent [email protected]'s password: [[email protected] ~]# rsync -avSHP /vm/centos7-disk1.qcow2 [email protected]:/vm/ [email protected]'s password: sending incremental file list centos7-disk1.qcow2 1361444864 100% 31.07MB/s 0:00:41 (xfer#1, to-check=0/1) sent 1361611141 bytes received 31 bytes 28665498.36 bytes/sec total size is 1361444864 speedup is 1.00
目标主机:
[[email protected] vm]# virsh list --all Id Name State ---------------------------------------------------- - centos6.7 shut off - centos6.7-1 shut off - centos6.7-2 shut off - centos7.1 shut off
以上是关于KVM--静态迁移的主要内容,如果未能解决你的问题,请参考以下文章