Improve copy function
[virt-p2v.git] / virt-p2v.1.txt
1 NAME
2     virt-p2v - P2V (physical to virtual machine) migration tool
3
4 SUMMARY
5     virt-p2v
6
7 DESCRIPTION
8     virt-p2v is a live CD for migrating physical machines to virtual machine
9     guests.
10
11     In the simplest mode of operation, you take a pre-built live CD ISO from
12     the main website (<http://et.redhat.com/~rjones/virt-p2v/>) and burn it
13     to a CD-R. Then insert the CD-R into the physical machine which must be
14     migrated, reboot, and follow the on-screen instructions. See STANDARD
15     USAGE section below.
16
17     You may also build a customized live CD. Typically this will contain
18     things like server details specific to your organization, so that the
19     live CD can run mostly or completely automatically. See BUILDING A
20     CUSTOM LIVE CD section below.
21
22     In both cases, files and disk images are transferred from the physical
23     machine over the network to the virtualization host machine over ssh.
24     Therefore "sshd" must be running on the virtualization host, and must be
25     accessible to that host. See SERVER REQUIREMENTS section below.
26
27     The "virt-p2v" script must only be run from the live CD. It isn't
28     designed to run outside this environment and could do Bad Things to your
29     machine if you try it. The script contains some checks to try to stop
30     you from doing this.
31
32     Virt-p2v does not modify the physical machine, its disks, configuration
33     etc.
34
35 STANDARD USAGE
36     After booting the live CD-R, you are presented with a series of
37     questions. This section explains each question.
38
39     Remote host
40         Enter the name or IP address of the virtualization host. This is the
41         host running Xen (or any other virtualization system supported by
42         libvirt, eg. QEMU). This host should be accessible on the network
43         and running an SSH daemon ("sshd").
44
45     Remote port
46         This is the port name or number of the SSH server on the remote
47         host. The default is 22 which is the standard SSH port.
48
49     Remote directory
50         Enter the directory on the remote host where disk image(s) and
51         configuration file(s) must reside.
52
53         Note that if the remote host is running SELinux then you may not be
54         able to start a Xen guest unless its disk image(s) are located in
55         the default directory, "/var/lib/xen/images".
56
57     Remote username
58         Enter the remote SSH username to use to log in to the remote host.
59
60         If you use the default username of "root" then you should ensure
61         that remote root logins are enabled on the remote host (ie.
62         "PermitRootLogin yes" in "/etc/ssh/sshd_config").
63
64     Network configuration
65         Choose the way that the live CD configures network access. The
66         current options are:
67
68         Automatic configuration
69             In this mode, the live CD attempts to reuse the network
70             configuration from the physical machine's root filesystem. You
71             should probably try this method even though occasionally it does
72             not work.
73
74         Ask for fixed IP address and gateway
75             In this mode the live CD will ask you for a fixed IP address and
76             gateway address, and will configure your chosen interface with
77             these.
78
79         Configure from the shell
80             In this mode you will be dropped into a command shell and you
81             will need to issue the correct sequence of "/sbin/ifconfig"
82             commands in order to configure the network interface.
83
84             A typical sequence of commands which should bring up the network
85             interface would be:
86
87              /sbin/ifconfig eth0 AA.BB.CC.DD
88              /sbin/route add default gw GG.HH.II.JJ eth0
89
90             where "AA.BB.CC.DD" is the IP address and "GG.HH.II.JJ" is the
91             gateway.
92
93         QEMU user network
94             This option configures the network for use inside a QEMU user
95             network
96             (<http://fabrice.bellard.free.fr/qemu/qemu-doc.html#SEC30>). It
97             should only be used by developers.
98
99     Devices
100         This question lists out all local block devices (hard disk drives
101         and similar) and asks you to choose which will be sent to the remote
102         host. You must send at least one block device.
103
104     Root device
105         This question lists out possible root filesystems and asks you to
106         choose the right one. Choose the filesystem which would normally be
107         mounted as "/" on the system.
108
109         Virt-p2v performs some autodetection and is in most cases able to
110         work out which filesystems are possible root filesystems. It
111         displays what it thinks is on each filesystem, but leaves it up to
112         the user to make a final decision.
113
114         The root filesystem is critical because it contains "/etc/fstab".
115         This is used during P2V both to determine how other filesystems are
116         normally mounted on the machine, and because this file and others
117         under "/etc" may need to be modified during P2V conversion.
118
119         If the machine has more than one root filesystem (typically because
120         the machine is dual-booted with another operating system), then you
121         must choose only one of them to perform the P2V conversion on.
122
123     Hypervisor
124         This question asks you to choose the hypervisor / virtualization
125         system in use on the remote host.
126
127         If you select *Xen*, *QEMU* or *KVM* then virt-p2v will produce a
128         configuration file which is customized for the selected system. If
129         you select *Other* then virt-p2v will produce a generic
130         configuration file which will probably require hand-modification to
131         work.
132
133         See also <http://libvirt.org/format.html>.
134
135     Machine architecture
136         This question asks you to choose the machine architecture. Virt-p2v
137         can normally detect this, so you should leave it as *Auto-detect*.
138
139     Memory
140         This question asks you to choose the amount of memory (RAM) in
141         megabytes assigned to the virtual machine.
142
143         If the entry is left blank, then virt-p2v will try to autodetect how
144         much RAM is present in the physical machine and use that, and this
145         is probably a good choice for most simple migrations.
146
147     Virtual CPUs
148         This question asks you to choose the number of virtual CPUs assigned
149         to the virtual machine. Choosing 1 causes the virtual machine to be
150         uniprocessor, and choosing some number greater than 1 causes the
151         virtual machine to be SMP.
152
153         If the entry is left blank, then virt-p2v will try to autodetect how
154         many CPU cores are present in the physical machine and use that, and
155         this is probably a good choice for most simple migrations.
156
157     MAC address
158         Here you should enter a MAC address for the virtual machine's
159         emulated network card. MAC addresses are written as
160         "aa:bb:cc:dd:ee:ff" where "aa", "bb" etc are hexadecimal octets.
161
162         Leaving it blank will cause virt-p2v to choose a random MAC address
163         within the "00:16:3e:.." space reserved for Xen guests. These MAC
164         addresses are not tested for uniqueness so there is a very small
165         chance that they could coincide, which would leave a guest unable to
166         access the virtual network.
167
168     Compression
169         Choose whether to enable or disable compression on disk images as
170         they are copied across the network.
171
172         If enabled, the "-C" option is passed to ssh(1). On fast networks
173         this can sometimes be slower.
174
175         NB: The disk image is still stored uncompressed on the remote host
176         however this option is set.
177
178     Verify and proceed
179         In this step you are asked to verify the settings above. If any are
180         incorrect, use the *Back* button to navigate back to the setting. If
181         all settings are correct, use the *OK* button to begin the P2V
182         conversion.
183
184     Network autoconfiguration
185         If you selected network autoconfiguration above then virt-p2v tries
186         to autoconfigure the network and ping the remote host. It then asks
187         *Did automatic network configuration work?*
188
189         You should answer "y" here if it worked.
190
191         Answering "n" will drop you into a command shell.
192
193         You can also switch to another virtual console if you need to
194         perform additional tests. See section GETTING A SHELL below.
195
196     SSH connection
197         Unless you have set up an SSH key, or the SSH server on the remote
198         host allows passwordless logins, then for each file that has to be
199         transferred to the remote host you will need to confirm the identity
200         of the remote host and/or enter a password.
201
202         To understand more about this, please see the ssh(1) manual page.
203
204   BOOTING P2V GUEST ON VIRTUALIZATION HOST
205     Once the P2V conversion has been completed, and assuming it was
206     successful, you will find a configuration file and one or more disk
207     images on the remote host.
208
209     The files will be located in the directory selected, usually
210     "/var/lib/xen/images". The names of the files are made up of:
211
212     "p2v-*hostname*-*YYYYMMDDHHMM*.conf" or
213     "p2v-*hostname*-*YYYYMMDDHHMM*-hd*X*.img"
214
215     To simply start up the guest, use the following commands as root:
216
217      virsh define p2v-foo-2008MMDDHHMM.conf
218      virsh start foo
219
220     For QEMU/KVM do:
221
222      virsh -c qemu:///system define p2v-foo-2008MMDDHHMM.conf
223      virsh -c qemu:///system start foo
224
225     For other hypervisors you will need to edit the configuration file and
226     read <http://libvirt.org/uri.html>.
227
228 GETTING A SHELL
229     During all stages of P2V questions and conversion you can get a root
230     shell on the physical machine. Use *ALT* *F2* keys to switch to the
231     second virtual console, then log in as *root* with no password.
232
233   LOG FILE
234     Virt-p2v writes a detailed log file to "/tmp/virt-p2v.log". (Note that
235     this "/tmp" directory is a ramdisk on the live CD, not the same as the
236     "/tmp" directory of the physical machine, and more importantly it
237     disappears when the machine is rebooted).
238
239     If you are reporting a bug, please always supply this file.
240
241 SERVER REQUIREMENTS
242     The virtualization host (remote host) must be running an SSH daemon
243     ("sshd"), accessible from the physical machine which is being migrated.
244
245     Previous versions of virt-p2v could use a special virt-p2v server.
246     However this capability has been removed since there was practically no
247     benefit.
248
249 BUILDING A CUSTOM LIVE CD
250     To build a custom live CD you must download the source for virt-p2v from
251     <http://et.redhat.com/~rjones/virt-p2v/> or from the Mercurial source
252     repository (see website for details).
253
254     Please read the "README" file to find the dependencies which are all in
255     Fedora &gt; 8 or EPEL &gt; 5.
256
257     The steps to creating a custom live CD are:
258
259     1. Edit "virt-p2v" and adjust defaults
260         Find the section "TO MAKE A CUSTOM virt-p2v SCRIPT ..." which is
261         near to the top of this file. Edit the defaults in this section as
262         detailed below.
263
264     2. "virt-p2v --test" to verify your changes
265         This command should not print anything at all. If it prints any
266         message, then you will need to fix the error by going back to the
267         first step.
268
269     3. "make build" or "make update" to build a custom live CD
270         "make build" will create a complete ISO from scratch. "make update"
271         can be used to build a "quick" developer ISO by updating an existing
272         ISO image. See section ISO ATTACHMENTS below for more details.
273
274     4. Burn the ISO to a CD-R and test
275
276   EDITING DEFAULTS IN THE "virt-p2v" SCRIPT
277     For each default, setting it to "None" will ask the user. All of the
278     defaults are set to "None" in the standard, uncustomized virt-p2v
279     script, and so the standard script asks all the questions.
280
281     You may edit "virt-p2v" and change the defaults, in which case the user
282     will not be questioned. In this way you can make the script partially or
283     fully automated.
284
285     *Note about OCaml code:* "None" and "Some foo" are similar to the
286     concept of a NULL pointer versus non-NULL pointer in other languages.
287     This a variant type defined as:
288
289     type α option = None | Some of α
290
291     "greeting"
292         If this is "true" then we wait for a keypress after boot and at a
293         couple of other stages. If set to "false" then we try not to wait
294         for any keypresses (so more automated live CDs are possible).
295
296     "remote_host"
297         Set this to "Some "hostname"" or "Some "IP-address"" to provide the
298         name of the remote host.
299
300     "remote_port"
301         Set this to "Some port" (eg. "Some 22") to provide the port number
302         of the remote host's SSH daemon.
303
304     "remote_directory"
305         Set this to "Some "path"" (eg. "Some "/var/lib/xen/images"") to
306         provide the directory where we update P2V converted images and
307         configuration files.
308
309     "remote_username"
310         Set this to "Some "username"" (eg. "Some "root"") to provide the SSH
311         username to use on the remote system.
312
313     "devices_to_send"
314         Set this to a list of block devices to send to the remote system.
315         For example, "Some ["sda"; "sdb"]".
316
317     "root_filesystem"
318         Set this to the name of the root filesystem.
319
320         For a disk partition (eg. "/dev/sda1"), use:
321
322          Some (Part ("sda", "1"))
323
324         For a logical volume (eg. "/dev/VolGroup00/LogVol00"), use:
325
326          Some (LV ("VolGroup00", "LogVol00"))
327
328     "network"
329         Set this to the choice for network setup. Use one of:
330
331         "Some Auto"
332             for auto-configuration
333
334         "Some Static"
335             to specify the interface, address, netmask and gateway
336             statically
337
338         "Some Shell"
339             to launch a shell
340
341         "Some QEMUUserNet"
342             to use a QEMU user network (developers only)
343
344     "static_network_config"
345         This setting only applies if "network" is set to "Some Static", in
346         which case you should set this to the static network settings, a
347         tuple of (interface, address, netmask, gateway, nameserver):
348
349          Some ("eth0", "192.168.2.5", "255.255.255.0", "192.168.2.1", "192.168.2.1")
350
351     "hypervisor"
352         Set this to the choice of hypervisor or virtualization system. The
353         choices are: "Some Xen", "Some QEMU" or "Some KVM".
354
355     "architecture"
356         Set this to the architecture. The choices are: "Some I386" (i386 and
357         up, 32 bit), "Some X86_64" (AMD and Intel x86-64, 64 bit), "Some
358         IA64" (Intel IA64), "Some PPC" (PowerPC, 32 bit), "Some PPC64"
359         (PowerPC, 64 bit), "Some SPARC" (Sun SPARC, 32 bit), "Some SPARC64"
360         (Sun SPARC, 64 bit), "OtherArch "foo"" (a hypothetical architecture
361         called *foo*), or "UnknownArch" to auto-detect the architecture.
362
363     "memory"
364         Set this to the size of memory in megabytes, eg. "Some 256". If you
365         set this to "Some 0" then virt-p2v will try to autodetect the amount
366         of RAM installed on the physical machine.
367
368     "vcpus"
369         Set this to the number of virtual CPUs, eg. "Some 1". If you set
370         this to "Some 0" then virt-p2v will try to autodetect the number of
371         CPU cores on the physical machine.
372
373     "mac_address"
374         Set this to the MAC address for the virtual network card, eg. "Some
375         "aa:bb:cc:dd:ee:ff"". If you set this to "Some """ then virt-p2v
376         will choose a random MAC address within the "00:16:3e:.." space
377         reserved for Xen guests. These MAC addresses are not tested for
378         uniqueness so there is a very small chance that they could coincide,
379         which would leave a guest unable to access the virtual network.
380
381     "compression"
382         Set this to "Some false" to disable compression, or "Some true" to
383         enable compression, or "None" to ask the user.
384
385   ISO ATTACHMENTS
386     Rebuilding a custom ISO is time-consuming. You can make a "quick"
387     developer ISO by updating an existing ISO image with a new custom
388     "virt-p2v" script. This is useful for testing purposes.
389
390     From the source directory, assuming that you have downloaded or built an
391     existing "virt-p2v-*.iso", you can just do:
392
393      make update
394
395     or the equivalent manual command:
396
397      ./iso-attach virt-p2v-VERSION.iso virt-p2v
398
399 BOOTING FROM A USB KEY INSTEAD OF A CD
400     If you wish to boot from a USB keydrive, use the livecd-iso-to-disk
401     tool:
402
403      livecd-iso-to-disk virt-p2v-$VERSION.iso /dev/sdX1
404
405     (Replace /dev/sdX1 with the actual USB device).
406
407     In my experience I also had to set up a suitable MBR:
408
409      cat /usr/lib/syslinux/mbr.bin > /dev/sdX
410
411 TESTING AN ISO UNDER QEMU OR KVM
412     If you have a virtual guest running under QEMU or KVM then you can test
413     the P2V conversion process on the guest.
414
415     (Technically this is a V2V -- virtual to virtual -- conversion).
416
417     From the source directory do:
418
419      make boot HDA=qemuimage.img
420
421     where "qemuimage.img" is the name of the QEMU/KVM image.
422
423     You can also supply an "HDB" parameter to specify a second disk.
424
425 MAILING LIST
426     Please direct questions to the et-mgmt-tools mailing list
427     <http://www.redhat.com/mailman/listinfo/et-mgmt-tools> <et-mgmt-tools @
428     redhat . com>
429
430 SEE ALSO
431     virsh(1), <http://www.libvirt.org/ocaml/>, <http://www.libvirt.org/>,
432     <http://et.redhat.com/~rjones/>, <http://caml.inria.fr/>
433
434 AUTHORS
435     Richard W.M. Jones <rjones @ redhat . com>
436
437 COPYRIGHT
438     (C) Copyright 2007-2008 Red Hat Inc., Richard W.M. Jones
439     http://libvirt.org/
440
441     This program is free software; you can redistribute it and/or modify it
442     under the terms of the GNU General Public License as published by the
443     Free Software Foundation; either version 2 of the License, or (at your
444     option) any later version.
445
446     This program is distributed in the hope that it will be useful, but
447     WITHOUT ANY WARRANTY; without even the implied warranty of
448     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
449     Public License for more details.
450
451     You should have received a copy of the GNU General Public License along
452     with this program; if not, write to the Free Software Foundation, Inc.,
453     675 Mass Ave, Cambridge, MA 02139, USA.
454
455 REPORTING BUGS
456     Bugs can be viewed on the Red Hat Bugzilla page:
457     <https://bugzilla.redhat.com/>.
458
459     If you find a bug in virt-p2v, please follow these steps to report it:
460
461     1. Check for existing bug reports
462         Go to <https://bugzilla.redhat.com/> and search for similar bugs.
463         Someone may already have reported the same bug, and they may even
464         have fixed it.
465
466     2. Capture debug and error messages
467         At the point where you get the error or unexpected behaviour, go to
468         the second virtual console (*ALT* *F2*) and look at the logfile
469         "/tmp/virt-p2v.log". Please make sure that this file is attached to
470         your bug report.
471
472     3. Get version of virt-p2v
473         The version is in the name of the ISO. If you have built a custom
474         virt-p2v ISO, please describe any changes that you have made.
475
476     4. Submit a bug report.
477         Go to <https://bugzilla.redhat.com/> and enter a new bug. Please
478         describe the problem in as much detail as possible.
479
480         Remember to include the version number (step 3) and to attach the
481         log file (step 2).
482
483     5. Assign the bug to rjones @ redhat.com
484         Assign or reassign the bug to rjones @ redhat.com (without the
485         spaces). You can also send me an email with the bug number if you
486         want a faster response.
487