1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
确保虚拟机是关机状态。
virsh
shutdown
centos73
virsh
dumpxml centos73 >
/etc/libvirt/qemu/centos735
.xml
//
如果是远程机器,需要把该配置文件拷贝到远程机器上
virsh
domblklist centos73
//
查看centos73子机的磁盘所在目录
Target Source
------------------------------------------------
vda
/data/kvm/centos73
.img
rsync
-avP
/data/kvm/centos73
.img
/data/kvm/centos735
.img
sending
incremental
file
list
centos73.img
17913741312 100% 124.45MB
/s
0:02:17 (xfer
#1, to-check=0/1)
sent
17915928126 bytes received 31 bytes 129356882.00 bytes
/sec
total size
is 17913741312 speedup is 1.00
//
如果是迁移到远程,则需要把该磁盘文件拷贝到远程机器上
vim
/etc/libvirt/qemu/centos735
.xml
//
因为是迁移到本机,配置文件用的是centos73子机的配置,不改会有冲突,所以需要修改该文件,如果是远程机器不用修改
修改domname, 修改uuid(随便更改一下数字,位数不要变)
<name>centos735<
/name
>
<uuid>2220a6d1-a36a-4fbb-8523-e078b3dfe796<
/uuid
>
<memory
unit=
'KiB'
>3145728<
/memory
>
<currentMemory
unit=
'KiB'
>3145728<
/currentMemory
>
<vcpu
placement=
'static'
>1<
/vcpu
>
修改磁盘路径:
<disk
type
=
'file'
device=
'disk'
>
<driver name=
'qemu'
type
=
'qcow2'
/>
<
source
file
=
'/data/kvm/centos735.img'
/>
<target dev=
'vda'
bus=
'virtio'
/>
<address
type
=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x06'
function
=
'0x0'
/>
<
/disk
>
[root@localhost
~]
# virsh list --all
Id
Name
State
----------------------------------------------------
-
centos73
shut off
-
centos732
shut off
-
centos733
shut off
-
centos734
shut off
[root@localhost
~]
# virsh define /etc/libvirt/qemu/centos735.xml
Domain
centos735 defined from
/etc/libvirt/qemu/centos735
.xml
[root@localhost
~]
# virsh list --all
Id
Name
State
----------------------------------------------------
-
centos73
shut off
-
centos732
shut off
-
centos733
shut off
-
centos734
shut off
-
centos735
shut off
|
本文转自 喵来个鱼 51CTO博客,原文链接:http://blog.51cto.com/m51cto/1958515,如需转载请自行联系原作者