As there is no direct VM conversion tool (from physical Linux server to Hyper-V VM), to perform P2V migration of RHEL5/CentOS5 physical server into Microsoft Hyper-V Virtual Machine you should use VMware platform as an intermediate point.
Below you will find instruction how to do it:
• migrate physical RHEL5/CentOS5 server to VMware ESXi Virtual Machine using VMware vCenter Converter Standalone Client (it support LVM)
• inside RHEL5 Virtual Machine (run on VMware ESXi host) install new kernel (kernel 2.6.18-398.el5) and Xorg server (1.1.1-48.101.0.1.el5.centos.3), you can use DVD install of CentOS 5.11
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
cd /media/cdrom/CentOS/
#install createrepo
rpm -i createrepo-0.4.11-3.el5.noarch.rpm
#copy files from DVD to HDD
mkdir /repo
cp /media/cdrom/* /samba/repo -R -v
#create repository
cd /repo
createrepo .
#set proper path inside *.repo file
#there are 3 "/" characters
baseurl=file:///repo
#remove RHN plugin (you will be no longer able to use RHN)
yum remove yum-rhn-plugin
#perform packages update (it will convert RHEL into CentOS when using CentOS repo)
yum update
#as alternative (to not perform full system update)
yum update kernel xorg-* selinux libselinux-*
#or when SELinux is disabled
yum update kernel xorg-*
#reboot
reboot
• inside RHEL5/CentOS5 generate new initrd file (using mkinitrd command) containing proper modules for running Linux on Hyper-V hypervisor:
• export VMware ESXi Virtual Machine virtual disk using VMware vSphere Client (export to OVF format, OVF contains VMDK disk files)
• convert virtual disks files from VMDK format (used by VMware) to VHDX format (used by Hyper-V) by using Microsoft Virtual Machine Converter (Powershell commands)
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath \\host.local\C$\ClusterStorage\Volume1\VMs\redhat5\redhat5-disk1.vmdk -VhdType DynamicHardDisk -VhdFormat vhdx -destination \\host.local\C$\ClusterStorage\Volume1\VMs\redhat5
• create new Virtual Machine (Type 1) on Hyper-V cluster (by using Failover Cluster Manager) an manually attach VHDX files as IDE disks