Thursday, October 15, 2009

Convert any computer to a virtual machine with Linux and Clonezilla

Last week Microsoft released Disk2VHD, a utility produced by its Sysinternals acquisition to convert a physical Windows hard disk into a Virtual PC disk image.

While handy, Microsoft is treading ground Linux already covered in the form of open source program Clonezilla, which handles a far richer variety of disk formats and platforms.

If you had an exclusive Windows-only shop then possibly Disk2VHD could be useful. This tool can run from a USB stick and will churn through a hard disk on an operational system, producing a VHD disk image out of it.

VHD is the virtual hard disk file format used by Microsoft’s Virtual PC and Hyper-V software. This means a legacy Windows 2000 server, say, could be captured and restored as a virtual machine on a modern Windows Server 2008 system ultimately reducing hardware and power consumption.

While this utility will undoubtedly serve a purpose, it has flaws. For one, it operates on a live system. Dumping an in-use hard disk can potentially give flawed results due to files in use. Modern versions of Windows offer shadow copy facilities which can mitigate this problem but that doesn’t apply to legacy releases of the operating system such as the Windows 2000 example above.

Additionally, it is a Windows only tool. You can’t run it on a Linux system. Perhaps Microsoft doesn’t see that as a problem but keep in mind Microsoft recently donated source code to the Linux kernel which specifically provided hooks for any Linux distribution to run on top of Windows Server 2008 in a Hyper-V virtualised environment. A tool to convert Linux disks to VHD format would support that effort.

A better solution is the already existing open source Clonezilla software which can run on Windows or Linux systems but is best used in its Linux Live CD form.

As a Live CD Clonezilla can be used to, as the name implies, clone any system without requiring it to be running and without installation.

Along with many other uses – like multicasting a corporate image to many PCs at one time – Clonezilla can be used to convert a system to a virtual machine in three simple steps.

First, boot the computer from Clonezilla. Clone the hard drive, or drives, to a CD, DVD, USB stick or any other medium. Last, boot the target virtual machine from the Clonezilla Live CD and restore the cloned drive.

It does not matter if the source system uses Windows or Linux; it does not matter if the virtual machine host is running Windows or Linux and it does not matter if the virtual machine environment comes from Microsoft, VMWare, Sun Microsystems, Xen or any other provider.

1 comment: