1virt-clone(1M) System Administration Commands virt-clone(1M)
2
3
4
6 virt-clone - clone virtual machine images
7
9 /usr/bin/virt-clone [option]
10
11
13 The virt-clone utility is a command line tool for cloning existing vir‐
14 tual machine images. virt-clone copies disk images of an existing vir‐
15 tual machine and defines a new guest with an identical virtual hardware
16 configuration. Elements that require uniqueness are updated to avoid a
17 clash between old and new guests.
18
19
20 With appropriate command-line arguments, virt-clone can run completely
21 unattended, with the guest automatically starting itself as well. This
22 allows for easy automation of guest installs.
23
24
25 If you do not specify options to virt-clone, the command runs interac‐
26 tively, prompting for input as required.
27
28
29 To run virt-clone, you must become superuser or assume the Primary
30 Administrator role.
31
33 The following options are supported:
34
35 --connect=URI
36
37 Connect to the hypervisor at URI.
38
39
40 -d, --debug
41
42 Display debugging information when running the install process.
43
44
45 -f disk_image, --file=disk_image
46
47 Path to the file, disk partition, or logical volume to use as the
48 backing store for the guest's virtual disk. If the original guest
49 has multiple disks, this parameter must be repeated multiple times,
50 once per disk in the original virtual machine.
51
52
53 --force-copy=target
54
55 Force to copy devices (for example, if hdc is a read-only CD-ROM
56 device, specify --force-copy=hdc)
57
58
59 -h, --help
60
61 Display the help message and exit.
62
63
64 -m mac_addr, --mac=mac_addr
65
66 Fixed MAC address for the guest. If the keyword random is speci‐
67 fied, a random address will be used.
68
69
70 -n name, --name=name
71
72 Name of the new guest virtual machine instance. This must be unique
73 among all guests known to the hypervisor on this machine, including
74 those not currently active. To redefine an existing guest, use the
75 virsh(1M) tool to shut it down and delete it prior to running virt-
76 clone. This parameter will be prompted for if omitted on the com‐
77 mand line.
78
79
80 --nonsparse
81
82 Do not use a sparse file for the clone's disk image.
83
84
85 -o original_guest, --original=original_guest
86
87 Name or UUID for the original guest to be cloned. This guest must
88 be shut down since it is not possible to safely clone active
89 guests.
90
91
92 --original-xml=filename
93
94 The libvirt guest XML file to use as the original guest. The guest
95 does not need to be defined on the libvirt connection.
96
97
98 --preserve-data
99
100 Preserve a new file to use as the disk image for the new guest.
101
102
103 -u UUID, --uuid=UUID
104
105 UUID for the guest; if none is specified, a random UUID is gener‐
106 ated. If you specify UUID, use a 32-digit hexadecimal number. Keep
107 in mind that UUIDs are intended to be unique across the entire data
108 center, and indeed, the world.
109
110
112 Example 1 Cloning a Guest with a Single Disk
113
114
115 The following command clones a guest named demo, which has a single
116 disk to copy.
117
118
119 # virt-clone \
120 --original demo \
121 --name newdemo \
122 --file /var/lib/xen/images/newdemo.img
123
124
125
126 Example 2 Cloning a Guest with Multiple Disks
127
128
129 The following command clones a guest named demo, with has multiple
130 disks to copy.
131
132
133 # virt-clone \
134 --original demo \
135 --name newdemo \
136 --file /var/lib/xen/images/newdemo.img \
137 --file /var/lib/xen/images/newdata.img
138
139
140
141 Example 3 Cloning to a Device with Comparable Disk Space
142
143
144 The following command clones a guest to a physical device that has at
145 least as much disk space as had the original guest. . If the destina‐
146 tion device is has more space, the new guest can do a file system
147 resize when it boots.
148
149
150 # virt-clone \
151 --name demo \
152 --file /dev/HostVG/DemoVM \
153 --mac 00:16:3e:34:11:54
154
155
156
158 See attributes(5) for descriptions of the following attributes:
159
160
161
162
163 ┌─────────────────────────────┬─────────────────────────────┐
164 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
165 ├─────────────────────────────┼─────────────────────────────┤
166 │Availability │SUNWxvmu │
167 ├─────────────────────────────┼─────────────────────────────┤
168 │Interface Stability │Volatile │
169 └─────────────────────────────┴─────────────────────────────┘
170
172 virsh(1M), virt-install(1M), xm(1M), xVM(5), attributes(5), xVM(5)
173
174
175
176SunOS 5.11 14 Feb 2009 virt-clone(1M)