1VIRT-CLONE(1) Virtual Machine Manager VIRT-CLONE(1)
2
3
4
6 virt-clone - clone existing virtual machine images
7
9 virt-clone [OPTION]...
10
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
16 require 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
21 generate 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 virt-
27 sysprep.
28
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
36 details
37
38 -o ORIGINAL_GUEST
39 --original ORIGINAL_GUEST
40 Name of the original guest to be cloned. This guest must be shut
41 off or paused since it is not possible to safely clone active
42 guests at this time.
43
44 --original-xml ORIGINAL_XML
45 Libvirt guest xml file to use as the original guest. The guest does
46 not need to be defined on the libvirt connection. This takes the
47 place of the "--original" parameter.
48
49 --auto-clone
50 Generate a new guest name, and paths for new storage.
51
52 An example or possible generated output:
53
54 Original name : MyVM
55 Generated clone name : MyVM-clone
56
57 Original disk path : /home/user/foobar.img
58 Generated disk path : /home/user/foobar-clone.img
59
60 If generated names collide with existing VMs or storage, a number
61 is appended, such as foobar-clone-1.img, or MyVM-clone-3.
62
63 -n NAME
64 --name NAME
65 Name of the new guest virtual machine instance. This must be unique
66 amongst all guests known to the hypervisor connection, including
67 those not currently active.
68
69 -u UUID
70 --uuid UUID
71 UUID for the guest; if none is given a random UUID will be
72 generated. If you specify UUID, you should use a 32-digit
73 hexadecimal number. UUID are intended to be unique across the
74 entire data center, and indeed world. Bear this in mind if manually
75 specifying a UUID
76
77 -f DISKFILE
78 --file DISKFILE
79 Path to the file, disk partition, or logical volume to use as the
80 backing store for the new guest's virtual disk. If the original
81 guest has multiple disks, this parameter must be repeated multiple
82 times, once per disk in the original virtual machine.
83
84 --nvram NVRAMFILE
85 Optional path to the new nvram VARS file, if no path is specified
86 and the guest has nvram the new nvram path will be auto-generated.
87 If the guest doesn't have nvram this option will be ignored.
88
89 --force-copy TARGET
90 Force cloning the passed disk target ('hdc', 'sda', etc.). By
91 default, "virt-clone" will skip certain disks, such as those marked
92 'readonly' or 'shareable'.
93
94 --skip-copy TARGET
95 Skip cloning the passed disk target ('hdc', 'sda', etc.). By
96 default, "virt-clone" will clone certain disk images, typically
97 read/write devices. Use this to skip copying of a specific device,
98 so the new VM uses the same storage path as the original VM.
99
100 --nonsparse
101 Fully allocate the new storage if the path being cloned is a sparse
102 file. See virt-install(1) for more details on sparse vs.
103 nonsparse.
104
105 --preserve-data
106 No storage is cloned: disk images specific by --file are preserved
107 as is, and referenced in the new clone XML. This is useful if you
108 want to clone a VM XML template, but not the storage contents.
109
110 --reflink
111 When --reflink is specified, perform a lightweight copy. This is
112 much faster if source images and destination images are all on the
113 same btrfs filesystem. If COW copy is not possible, then virt-
114 clone fails.
115
116 -m MAC
117 --mac MAC
118 Fixed MAC address for the guest; If this parameter is omitted, or
119 the value "RANDOM" is specified a suitable address will be randomly
120 generated. Addresses are applied sequentially to the networks as
121 they are listed in the original guest XML.
122
123 --print-xml
124 Print the generated clone XML and exit without cloning.
125
126 --replace
127 Shutdown and remove any existing guest with the passed "--name"
128 before cloning the original guest.
129
130 -h
131 --help
132 Show the help message and exit
133
134 --version
135 Show program's version number and exit
136
137 --check
138 Enable or disable some validation checks. See virt-install(1) for
139 more details.
140
141 -q
142 --quiet
143 Suppress non-error output.
144
145 -d
146 --debug
147 Print debugging information to the terminal when running the
148 install process. The debugging information is also stored in
149 "~/.cache/virt-manager/virt-clone.log" even if this parameter is
150 omitted.
151
153 Clone the guest called "demo" on the default connection, auto
154 generating a new name and disk clone path.
155
156 # virt-clone \
157 --original demo \
158 --auto-clone
159
160 Clone the guest called "demo" which has a single disk to copy
161
162 # virt-clone \
163 --original demo \
164 --name newdemo \
165 --file /var/lib/xen/images/newdemo.img
166
167 Clone a QEMU guest with multiple disks
168
169 # virt-clone \
170 --connect qemu:///system \
171 --original demo \
172 --name newdemo \
173 --file /var/lib/xen/images/newdemo.img \
174 --file /var/lib/xen/images/newdata.img
175
176 Clone a guest to a physical device which is at least as big as the
177 original guests disks. If the destination device is bigger, the new
178 guest can do a filesystem resize when it boots.
179
180 # virt-clone \
181 --connect qemu:///system \
182 --original demo \
183 --name newdemo \
184 --file /dev/HostVG/DemoVM \
185 --mac 52:54:00:34:11:54
186
188 Please see <https://virt-manager.org/bugs>
189
191 Copyright (C) Fujitsu Limited, Copyright (C) Red Hat, Inc, and various
192 contributors. This is free software. You may redistribute copies of it
193 under the terms of the GNU General Public License
194 "https://www.gnu.org/licenses/gpl.html". There is NO WARRANTY, to the
195 extent permitted by law.
196
198 "virt-sysprep(1)", virsh(1), "virt-install(1)", "virt-manager(1)", the
199 project website "https://virt-manager.org"
200
201
202
2032.2.1 2019-07-27 VIRT-CLONE(1)