Tutorial: Moving a Centos physical server with Soft RAID to be a KVM virtual machine guest using virt-p2v and virt-v2v
I have used KVM for several years on Centos as a platform for running virtualized servers, and my experiences have been very good
Now I have the case where I want to move a physical Centos server running RAID 10 on soft RAID, to a Centos KVM server.
There are several ways to create a VM guest from physical server however it is a complex process and plenty of things can go wrong on the way.
The safest way to do it is to use virt-v2v and virt-p2v.
These are Red Hat created tools but can be downloaded even if you are not a Red Hat user.
The (source) physical server will be running virt-p2v (physical to virtual) and the conversion server (in this case also the target server) will do the conversion to be a KVM guest
Source - the physical server:
The source is the physical server.
- To handle the transition to be a KVM virtual machine guest, you need to shutdown the running server.
- The physical server will boot up on virt-p2v
Read about virt-p2v here: http://libguestfs.org/virt-p2v.1.html
- Download virt-p2v ISO image here: http://oirase.annexia.org/virt-p2v/
- Create a bootable device from the ISO image. I use Rufus to do this (https://rufus.akeo.ie/)
- Have the server boot up in virt-p2v from the bootable device just created
- You will be sending a LOT of data over the network, so a fast network is good and make sure the server can "see" each other (firewall, network segments..)
1) enter the IP of the conversion server
2) enter user name on the conversion server (root)
3) password of user on conversion server.
4) test that you can connect to conversion server.
When OK press "Next" you will see the next and last setup screen
I will show what to fill in.
1) First give the VM a name
2) This is the number of virtual CPUs
3) Amount of RAM
(You can always change the numbers after the VM has been created)
1) There are several options here
Since I want to create a VM guest on the conversion server I select "libvirt"
2) I leave this empty since I want the process to create a new VM with the name "New Centos Server"
3) Leave blank
4) The format for the VM. The RAW and QCOW2 format are supported. RAW is fastest, but QCOW2 has many more features like snapshots, sparse ..
I choose QCOW2
5) Choose between "Sparse" and "Preallocated". Using Sparse the disk will expand as needed, using less space to start with. However preallocating all the space for disks will speed up write times dramatically.
So if you are using something write heavy use Preallocated.
I choose "sparse" here in this demo.
Virt-p2v are a bit smart an will investigate the source disks and only send real data on disks, not deleted files, empty spaces etc.
Choose which disk to move to VM. I use soft RAID here so it is important to get all disks moved to new server.
Don't move the boot device over, unselect here
Select the network cards to move over
Since KVM may not have the drivers for the physical devices the conversion process will go in and investigate the installation and substitute with KVM available drivers which means in most
cases Virtio drivers since they will be the fastest drivers. Virtio drivers are Paravirtualized drivers, which gives near "bear metal" performance.
Linux will have the virtio drivers installed already, but if guest is MS Windows you need to download the virtio drivers and install them. You will also need to install libguestfs-winsupport.
Target - the KVM guest
To handle the conversion on the target Centos server you need to install virt-v2v.
Prerequsits: KVM/QEMU is already installed on target server
- yum install virt-v2v
To administer the VM guest install virt-manager
- yum install virt-manager
Running the conversion
Go back to the physical server and click on the "Start conversion" button
virt-p2p will report as it goes a long. I will start with the conversion and then moved the disk over.
Any other status than 0 means there was an issue
Open the Virt Manager and voila ! :-)
The server is now running on the target KVM server
Devices on the KVM guest
The is example has been an Centos physical server, but other OS is supported too:
Red Hat Enterprise Linux 3.9
Red Hat Enterprise Linux 4
Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 7.1 and later
Windows Server 2003
Windows Server 2008
Windows Server 2008 R2
Windows Server 2012
Windows Server 2012 R2
virt-v2v can of course also move VM guests from other VM platforms:
Red Hat Enterprise Linux 5 Xen
VMware vSphere ESX / ESX(i) - versions 3.5, 4.0, 4.1, 5.0, 5.1, 5.5, 6.0
Posted on 11/03/2017 11:20:46 PM CET