Difference between revisions of "Virt-clone"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
|||
(40 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <code>virt-clone</code> command is | + | <code>virt-clone</code> command is included in <code>[[virtinst]]</code> package in [[Ubuntu]]. |
+ | https://linux.die.net/man/1/virt-clone | ||
+ | == Clonning == | ||
+ | :0) Stop origin virtual machine: <code>[[virsh shutdown]] OLD_MACHINE</code> | ||
+ | :1) <code>virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE [[--auto-clone]]</code> | ||
+ | :2) Rename <code>[[qcow2]]</code> files and edit xml file our use <code>[[virsh edit]]</code> | ||
+ | :3) <code>[[virsh start]] NEW_MACHINE</code> | ||
+ | :4) Connect to new server and: <code>[[hostnamectl set-hostname]] NEW_SERVER_NAME</code> | ||
+ | :5) Modify <code>/etc/cloud/[[cloud.cfg]]</code> and change: <code>preserve_hostname=true</code> | ||
+ | :6) Modify [[IP]]: <code>[[/etc/]][[netplan]]/[[50-cloud-init.yaml]]</code> | ||
− | |||
+ | virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone | ||
+ | Allocation 'XXXXX-clone.[[qcow2]] 24% .... | ||
+ | == Errors == | ||
+ | virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone | ||
+ | ERROR Disk /path/to/file.qcow2 is already in use by other guests ['OTHER_MACHINE']. (Use --check path_in_use=off or --check all=off to override) | ||
+ | Solution: | ||
+ | [[virsh undefine]] OTHER_MACHINE | ||
+ | |||
+ | virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone | ||
+ | ERROR Either --auto-clone or --file is required, use '--auto-clone or --file' and try again | ||
== Related commands == | == Related commands == | ||
* <code>[[virt-sysprep]]</code> (<code>[[libguestfs-tools]]</code> package) | * <code>[[virt-sysprep]]</code> (<code>[[libguestfs-tools]]</code> package) | ||
− | * <code>[[virt- | + | * <code>[[virsh edit]]</code> |
+ | * <code>/etc/libvirt/[[qemu]]</code> | ||
+ | * <code>[[qemu-img convert]]</code> | ||
+ | * <code>[[virt-install]]</code>, <code>[[virt-resize]]</code> | ||
+ | * <code>[[virt-manager]]</code> | ||
+ | * <code>[[virsh vol-clone]]</code> | ||
+ | * <code>[[virsh domrename]]</code> | ||
== Activities == | == Activities == | ||
Line 17: | Line 41: | ||
== See also == | == See also == | ||
+ | * {{virtinst}} | ||
+ | * {{QEMU}} | ||
+ | * {{libvirtd}} | ||
* {{KVM}} | * {{KVM}} | ||
[[Category:KVM]] | [[Category:KVM]] |
Latest revision as of 07:37, 26 August 2020
virt-clone
command is included in virtinst
package in Ubuntu.
https://linux.die.net/man/1/virt-clone
Clonning[edit]
- 0) Stop origin virtual machine:
virsh shutdown OLD_MACHINE
- 1)
virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone
- 2) Rename
qcow2
files and edit xml file our usevirsh edit
- 3)
virsh start NEW_MACHINE
- 4) Connect to new server and:
hostnamectl set-hostname NEW_SERVER_NAME
- 5) Modify
/etc/cloud/cloud.cfg
and change:preserve_hostname=true
- 6) Modify IP:
/etc/netplan/50-cloud-init.yaml
virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone Allocation 'XXXXX-clone.qcow2 24% ....
Errors[edit]
virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone ERROR Disk /path/to/file.qcow2 is already in use by other guests ['OTHER_MACHINE']. (Use --check path_in_use=off or --check all=off to override) Solution: virsh undefine OTHER_MACHINE
virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone ERROR Either --auto-clone or --file is required, use '--auto-clone or --file' and try again
Related commands[edit]
virt-sysprep
(libguestfs-tools
package)virsh edit
/etc/libvirt/qemu
qemu-img convert
virt-install
,virt-resize
virt-manager
virsh vol-clone
virsh domrename
Activities[edit]
- Clone a virtual machine using https://www.cyberciti.biz/faq/how-to-clone-existing-kvm-virtual-machine-images-on-linux/ as reference
See also[edit]
virtinst
(package):virt-install
,virt-clone
,virt-convert
andvirt-xml
- QEMU:
qemu-img
,qemu-ga
,qemu.conf
,virsh qemu
, QEMU guest agent (qemu-ga
), qcow2,qemu-nbd, qemu-img map
,qemu-io
,/etc/libvirt/qemu.conf
, QEMU releases, VENOM,qemu-nbd --help, qemu-system
- libvirtd:
systemctl status libvirtd
,systemctl status libvirt-guests
, Libvirt release notes, logs,libvirtd.conf
,/etc/libvirt/
,/var/log/libvirt/
- KVM, Installation, QEMU,
virsh
,virtinst
,libguestfs-tools
, libvirt, qemu, Red Hat Virtualization (RHV), MacVTap, Virtio, oVirt, KVM services, KVM networking, KVM graphics, CPU, KVM on ARM
Advertising: