1VIRT-CLONE(1) Virtual Machine Install Tools 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. An
22 interactive mode is available with the --prompt option, but this will
23 only ask for the minimum required options.
24
26 Most options are not required. Minimum requirements are --original or
27 --original-xml (to specify the guest to clone), --name, and appropriate
28 storage options via -file.
29
30 -h, --help
31 Show the help message and exit
32
33 --connect=CONNECT
34 Connect to a non-default hypervisor. See virt-install(1) for
35 details
36
37 General Options
38 General configuration parameters that apply to all guest clones.
39
40 -o ORIGINAL_GUEST, --original=ORIGINAL_GUEST
41 Name of the original guest to be cloned. This guest must be shut off
42 or paused since it is not possible to safely clone active guests at
43 this time.
44
45 --original-xml=ORIGINAL_XML
46 Libvirt guest xml file to use as the original guest. The guest does
47 not need to be defined on the libvirt connection. This takes the
48 place of the "--original" parameter.
49
50 --auto-clone
51 Generate a new guest name, and paths for new storage.
52
53 An example or possible generated output:
54
55 Original name : MyVM
56 Generated clone name : MyVM-clone
57
58 Original disk path : /home/user/foobar.img
59 Generated disk path : /home/user/foobar-clone.img
60
61 If generated names collide with existing VMs or storage, a number is
62 appended, such as foobar-clone-1.img, or MyVM-clone-3.
63
64 -n NAME, --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, --uuid=UUID
70 UUID for the guest; if none is given a random UUID will be generated.
71 If you specify UUID, you should use a 32-digit hexadecimal number.
72 UUID are intended to be unique across the entire data center, and
73 indeed world. Bear this in mind if manually specifying a UUID
74
75 Storage Configuration
76 -f DISKFILE, --file=DISKFILE
77 Path to the file, disk partition, or logical volume to use as the
78 backing store for the new guest's virtual disk. If the original guest
79 has multiple disks, this parameter must be repeated multiple times,
80 once per disk in the original virtual machine.
81
82 --force-copy=TARGET
83 Force cloning the passed disk target ('hdc', 'sda', etc.). By
84 default, "virt-clone" will skip certain disks, such as those marked
85 'readonly' or 'shareable'.
86
87 --nonsparse
88 Fully allocate the new storage if the path being cloned is a sparse
89 file. See virt-install(1) for more details on sparse vs. nonsparse.
90
91 --preserve-data
92 No storage is cloned: disk images specific by --file are preserved as
93 is, and referenced in the new clone XML. This is useful if you want
94 to clone a VM XML template, but not the storage contents.
95
96 Networking Configuration
97 -m MAC, --mac=MAC
98 Fixed MAC address for the guest; If this parameter is omitted, or the
99 value "RANDOM" is specified a suitable address will be randomly
100 generated. Addresses are applied sequentially to the networks as they
101 are listed in the original guest XML.
102
103 Miscellaneous Options
104 --print-xml
105 Print the generated clone XML and exit without cloning.
106
107 -d, --debug
108 Print debugging information to the terminal when running the install
109 process. The debugging information is also stored in
110 "$HOME/.virtinst/virt-clone.log" even if this parameter is omitted.
111
112 --force
113 Prevent interactive prompts. If the intended prompt was a yes/no
114 prompt, always say yes. For any other prompts, the application will
115 exit.
116
117 --prompt
118 Specifically enable prompting for required information. Default
119 prompting is off.
120
122 Clone the guest called "demo" on the default connection, auto
123 generating a new name and disk clone path.
124
125 # virt-clone \
126 --original demo \
127 --auto-clone
128
129 Clone the guest called "demo" which has a single disk to copy
130
131 # virt-clone \
132 --original demo \
133 --name newdemo \
134 --file /var/lib/xen/images/newdemo.img
135
136 Clone a QEMU guest with multiple disks
137
138 # virt-clone \
139 --connect qemu:///system \
140 --original demo \
141 --name newdemo \
142 --file /var/lib/xen/images/newdemo.img \
143 --file /var/lib/xen/images/newdata.img
144
145 Clone a guest to a physical device which is at least as big as the
146 original guests disks. If the destination device is bigger, the new
147 guest can do a filesystem resize when it boots.
148
149 # virt-clone \
150 --connect qemu:///system \
151 --name demo \
152 --file /dev/HostVG/DemoVM \
153 --mac 52:54:00:34:11:54
154
156 Written by Kazuki Mizushima, and a team of many other contributors. See
157 the AUTHORS file in the source distribution for the complete list of
158 credits.
159
161 Please see http://virt-manager.org/page/BugReporting
162
164 Copyright (C) Fujitsu Limited 2007, and various contributors. This is
165 free software. You may redistribute copies of it under the terms of the
166 GNU General Public License "http://www.gnu.org/licenses/gpl.html".
167 There is NO WARRANTY, to the extent permitted by law.
168
170 virsh(1), "virt-install(1)", "virt-manager(1)", the project website
171 "http://virt-manager.org"
172
173
174
175 2010-12-17 VIRT-CLONE(1)