I mentioned in a post last week that I would go over some options to perform a Linux Physical to Virtual (P2V) migration on Hyper-V.  Before showing you the easy way, I wanted to go over a manual approach that a coworker worked out for me a while back.  Even before that, I wanted to review why some common P2V methods don’t work that well for capturing a Linux physical machine.

Windows P2V Tools Expect NTFS

That’s something to keep in mind – all those tools you’ve used for Windows P2V migrations including SCVMM, Disk2VHD, ImageX and others all work great because they know how to work with NTFS well.  NTFS is a known quantity, and systems that are based on Windows XP / Windows Server 2003 or newer also have VSS to enable live, running snapshots and easier migration.  Common P2V tools can leverage VSS and NTFS to make migration and backup easier.

Linux Systems Don’t Use NTFS

You have multiple file system choices in the 300+ Linux distributions available to you, but you won’t see writable NTFS (I never have).  The common file systems I run into are ext2 and ext3 – not file systems that most Windows systems or tools can access (all though it is possible).  Without NTFS, there also is no VSS support, so tools like Disk2VHD cannot do their work.

Manual Linux P2V Steps

The process for manually moving a Linux system into a Hyper-V VM is similar to the process I have used with WinPE and ImageX:

  1. Capture source image
  2. Define / Configure VM
  3. Transfer Image to VM
  4. Apply image to VM
  5. Fix Up Disk in VM
  6. Update VM

I asked a “Linux Veteran” for help with a generic, manual process.  The Linux veteran (I’ll call him Mr.Z) used Ubuntu successfully for a quick test of this process.  I tried it with CentOS and Ubuntu with not quite optimal results, but my failure highlights some of the challenges of the process.  Mr. Z gave me a great writeup of the manual  process he used (using commands oyu may / may not know as a Windows admin like tar or cpio, mkfs, mkswap, mount, fdisk, scp, Sudo, and by editing all sorts of files).

What did I find out?  Each distribution of Linux (and separate installation) required different manual handling – depending on all sorts of variables including the file system used (ext3 or ext4, or other), shadow password files, and available commands (not all distros have all the same tools!).

Conclusion

Manual P2V of Linux systems is not the easiest thing in the world to accomplish without a good understanding of the Linux distribution employed, the file system used, and other implementation specifics including security practices.  Yes, manual P2V of Linux hosts to Hyper-V can be accomplished (similar to what I’ve done in the past with ImageX and WinPE), but it may not be practical.  I’ll try in the next few weeks to go over some automated solutions for Linux P2V migrations to Hyper-V, as well as some “semi-homemade” approaches that can take the edge of of the manual process.

-John