Difference between revisions of "Virt-clone"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
Line 9: Line 9:
 
:3) <code>[[virsh start]] NEW_MACHINE</code>
 
:3) <code>[[virsh start]] NEW_MACHINE</code>
 
:4) Connect to new server and: <code>[[hostnamectl]] set-hostname NEW_SERVER_NAME</code>
 
:4) Connect to new server and: <code>[[hostnamectl]] set-hostname NEW_SERVER_NAME</code>
:5) Modify [[IP]]: <code>[[/etc/]][[netplan]]/</code>
+
:5) Modify [[IP]]: <code>[[/etc/]][[netplan]]/[[50-cloud-init.yaml]]</code>
  
  
 
   virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone
 
   virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone
 
   Allocation 'XXXXX-clone.[[qcow2]]    24% ....
 
   Allocation 'XXXXX-clone.[[qcow2]]    24% ....
+
 
 
== Errors ==
 
== Errors ==
 
  virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone
 
  virt-clone --original ORIGIN_MACHINE --name NEW_MACHINE --auto-clone

Revision as of 10:20, 21 July 2020

virt-clone command is included in virtinst package in Ubuntu.

https://linux.die.net/man/1/virt-clone

Clonning

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 use virsh edit
3) virsh start NEW_MACHINE
4) Connect to new server and: hostnamectl set-hostname NEW_SERVER_NAME
5) Modify IP: /etc/netplan/50-cloud-init.yaml


 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


Related commands

Activities


See also

Advertising: