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 --nonsparse
95 Fully allocate the new storage if the path being cloned is a sparse
96 file. See virt-install(1) for more details on sparse vs.
97 nonsparse.
98
99 --preserve-data
100 No storage is cloned: disk images specific by --file are preserved
101 as is, and referenced in the new clone XML. This is useful if you
102 want to clone a VM XML template, but not the storage contents.
103
104 --reflink
105 When --reflink is specified, perform a lightweight copy. This is
106 much faster if source images and destination images are all on the
107 same btrfs filesystem. If COW copy is not possible, then virt-
108 clone fails.
109
110 -m MAC
111 --mac MAC
112 Fixed MAC address for the guest; If this parameter is omitted, or
113 the value "RANDOM" is specified a suitable address will be randomly
114 generated. Addresses are applied sequentially to the networks as
115 they are listed in the original guest XML.
116
117 --print-xml
118 Print the generated clone XML and exit without cloning.
119
120 --replace
121 Shutdown and remove any existing guest with the passed "--name"
122 before cloning the original guest.
123
124 -h
125 --help
126 Show the help message and exit
127
128 --version
129 Show program's version number and exit
130
131 --check
132 Enable or disable some validation checks. See virt-install(1) for
133 more details.
134
135 -q
136 --quiet
137 Suppress non-error output.
138
139 -d
140 --debug
141 Print debugging information to the terminal when running the
142 install process. The debugging information is also stored in
143 "~/.cache/virt-manager/virt-clone.log" even if this parameter is
144 omitted.
145
147 Clone the guest called "demo" on the default connection, auto
148 generating 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
182 Please see https://virt-manager.org/page/BugReporting
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
192 "virt-sysprep(1)", virsh(1), "virt-install(1)", "virt-manager(1)", the
193 project website "https://virt-manager.org"
194
195
196
1972.0.0 2019-07-01 VIRT-CLONE(1)