1VIRT-CLONE(1)               Virtualization Support               VIRT-CLONE(1)
2
3
4

NAME

6       virt-clone - clone existing virtual machine images
7

SYNOPSIS

9       virt-clone [OPTION]...
10

DESCRIPTION

12       virt-clone  is a command line tool for cloning existing virtual machine
13       images using the libvirt hypervisor management library.  It  will  copy
14       the disk images of any existing virtual machine, and define a new guest
15       with an identical virtual hardware configuration.  Elements  which  re‐
16       quire  uniqueness  will be updated to avoid a clash between old and new
17       guests.
18
19       By default, virt-clone will show an error if the necessary  information
20       to clone the guest is not provided. The --auto-clone option will gener‐
21       ate all needed input, aside from the source guest to clone.
22
23       Please note, virt-clone does not change anything _inside_ the guest OS,
24       it  only  duplicates  disks  and does host side changes. So things like
25       changing passwords, changing static IP address,  etc  are  outside  the
26       scope   of   this   tool.  For  these  types  of  changes,  please  see
27       virt-sysprep.
28

GENERAL OPTIONS

30       Most options are not required. Minimum requirements are  --original  or
31       --original-xml (to specify the guest to clone), --name, and appropriate
32       storage options via -file.
33
34       --connect URI
35              Connect to a non-default hypervisor. See virt-install(1) for de‐
36              tails
37
38       -o, --original ORIGINAL_GUEST
39              Name of the original guest to be cloned. This guest must be shut
40              off.
41
42       --original-xml ORIGINAL_XML
43              Libvirt guest xml file to use as the original guest.  The  guest
44              does  not  need  to  be  defined on the libvirt connection. This
45              takes the place of the --original parameter.
46
47       --auto-clone
48              Generate a new guest name, and paths for new storage.
49
50              An example of possible generated output:
51
52                 Original name        : MyVM
53                 Generated clone name : MyVM-clone
54
55                 Original disk path   : /home/user/foobar.img
56                 Generated disk path  : /home/user/foobar-clone.img
57
58              If generated names collide with existing VMs or storage, a  num‐
59              ber is appended, such as foobar-clone-1.img, or MyVM-clone-3.
60
61       -n, --name NAME
62              Name  of  the  new  guest virtual machine instance. This must be
63              unique amongst all guests known to  the  hypervisor  connection,
64              including those not currently active.
65
66       -u, --uuid UUID
67              UUID  for the guest; if none is given a random UUID will be gen‐
68              erated. If you specify UUID, you should use a 32-digit hexadeci‐
69              mal  number.  UUID  are  intended to be unique across the entire
70              data center, and indeed world. Bear this  in  mind  if  manually
71              specifying a UUID
72
73       -f, --file PATH
74              Path  to  the  file, disk partition, or logical volume to use as
75              the backing store for the new guest's virtual disk. If the orig‐
76              inal  guest  has multiple disks, this parameter must be repeated
77              multiple times, once per disk in the original virtual machine.
78
79       --nvram NVRAMFILE
80              Optional path to the new nvram VARS file, if no path  is  speci‐
81              fied  and  the  guest  has  nvram  the  new  nvram  path will be
82              auto-generated. If the guest doesn't have nvram this option will
83              be ignored.
84
85       --force-copy TARGET
86              Force  cloning  the  passed disk target ('hdc', 'sda', etc.). By
87              default, virt-clone will  skip  certain  disks,  such  as  those
88              marked 'readonly' or 'shareable'.
89
90       --skip-copy TARGET
91              Skip cloning the passed disk target ('hdc', 'sda', etc.). By de‐
92              fault, virt-clone will  clone  certain  disk  images,  typically
93              read/write  devices.  Use this to skip copying of a specific de‐
94              vice, so the new VM uses the same storage path as  the  original
95              VM.
96
97       --nonsparse
98              Fully  allocate  the  new  storage if the path being cloned is a
99              sparse file.  See virt-install(1) for more details on sparse vs.
100              nonsparse.
101
102       --preserve-data
103              No  storage  is  cloned: disk images specific by --file are pre‐
104              served as is, and referenced in the new clone XML. This is  use‐
105              ful  if you want to clone a VM XML template, but not the storage
106              contents.
107
108       --reflink
109              When --reflink is specified, perform a lightweight copy. This is
110              much  faster  if source images and destination images are all on
111              the same btrfs filesystem.  If COW copy is  not  possible,  then
112              virt-clone fails.
113
114       -m, --mac MAC
115              Fixed  MAC  address for the guest; If this parameter is omitted,
116              or the value RANDOM is specified a suitable address will be ran‐
117              domly  generated. Addresses are applied sequentially to the net‐
118              works as they are listed in the original guest XML.
119
120       --print-xml
121              Print the generated clone XML and exit without cloning.
122
123       --replace
124              Shutdown and remove any existing guest with  the  passed  --name
125              before cloning the original guest.
126
127       -h, --help
128              Show the help message and exit
129
130       --version
131              Show program's version number and exit
132
133       --check
134              Enable  or  disable  some validation checks. See virt-install(1)
135              for more details.
136
137       -q, --quiet
138              Suppress non-error output.
139
140       -d, --debug
141              Print debugging information to the terminal when running the in‐
142              stall  process.   The  debugging  information  is also stored in
143              ~/.cache/virt-manager/virt-clone.log even if this  parameter  is
144              omitted.
145

EXAMPLES

147       Clone  the guest called demo on the default connection, auto generating
148       a new name and disk clone path.
149
150          # virt-clone \
151               --original demo \
152               --auto-clone
153
154       Clone the guest called demo which has a single disk to copy
155
156          # virt-clone \
157               --original demo \
158               --name newdemo \
159               --file /var/lib/xen/images/newdemo.img
160
161       Clone a QEMU guest with multiple disks
162
163          # virt-clone \
164               --connect qemu:///system \
165               --original demo \
166               --name newdemo \
167               --file /var/lib/xen/images/newdemo.img \
168               --file /var/lib/xen/images/newdata.img
169
170       Clone a guest to a physical device which is at  least  as  big  as  the
171       original  guests  disks.  If  the destination device is bigger, the new
172       guest can do a filesystem resize when it boots.
173
174          # virt-clone \
175               --connect qemu:///system \
176               --original demo \
177               --name newdemo \
178               --file /dev/HostVG/DemoVM \
179               --mac 52:54:00:34:11:54
180

BUGS

182       Please see https://virt-manager.org/bugs
183
185       Copyright (C) Fujitsu Limited, Copyright (C) Red Hat, Inc, and  various
186       contributors.  This is free software. You may redistribute copies of it
187       under   the   terms    of    the    GNU    General    Public    License
188       https://www.gnu.org/licenses/gpl.html.   There  is  NO WARRANTY, to the
189       extent permitted by law.
190

SEE ALSO

192       virt-sysprep(1),  virsh(1),   virt-install(1),   virt-manager(1),   the
193       project website https://virt-manager.org
194
195
196
197
198                                                                 VIRT-CLONE(1)
Impressum