KVM Guests: Windows NT… What?

KVM Guests: Windows NT… What?

OK so you have been kicking around an old NT machine for years, neigh, a decade.  So what do you do with it?  Realistically the machine has already sustained numerous failures, and it won’t make it through another one.  We have all fought this battle.  I personally fought this battle many years ago and frankly P2V is never clean when coming from NT.  But if you could upgrade then you would have already.

I fought the original P2V battle with NT many years ago (and emerged bloody but victorious), I don’t remember the exact process we went through but it wound its way through every virtualization product to get it to its final resting place of Hyper-V (or so we thought).  The purpose of this article is to help you get NT running on Linux KVM, in my case from a Hyper-V VM, though a “fresh” install should work as well.  For those of you looking to go from physical, when I did it years ago I think I used VMWare Converter to create an image, and then the VirtualBox tools to convert it to vdi, and then to vhd (fully allocated).  Then once that was done got it running in VirtualBox before dragging it to Hyper-V.

Final, Working XML

<domain type='kvm'>
<name>ntmachine</name>
<description>NT Machine</description>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc-0.14'>hvm</type>
<boot dev='hd'/>
</os>
<cpu match='exact'>
<model>pentium</model>
</cpu>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/usdckvm202/vm_newmfg_boot'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<controller type='ide' index='0'>
</controller>
<interface type='bridge'>
<mac address='00:1d:d8:b7:1c:5f'/>
<source bridge='br0'/>
<model type='ne2k_pci'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<video>
<model type='vga' vram='9216' heads='1'/>
</video>
</devices>
</domain>

Now in the above there are a couple of key areas I want to point out.  The CPU, Network Cards, and Disks are key.

CPU

We need to virtualize a specific processor to make NT happy, in this case the predominant processor of the era was the pentium.

<cpu match='exact'>
<model>pentium</model>
</cpu>

Network Cards

In order to have working networking we must emulate a network device which actually existed, the ne2k_pci NIC was very common and has a driver included in the NT Server CD the RTL80292.

<interface type='bridge'>
<mac address='00:1d:d8:b7:1c:5f'/>
<source bridge='br0'/>
<model type='ne2k_pci'/>
</interface>

Disks

Here we just need to use IDE, no VirtIO (obviously).  Also here I am using a Logical Volume instead of a raw disk image file, simply because that is how I like to run my production environments, if you plan on using a file, then adjust your XML so that you are referencing a file.

<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/usdckvm202/vm_newmfg_boot'/>
<target dev='hda' bus='ide'/>
</disk>

Other Notes

I also removed anything extraneous that I thought could cause problems, everything in the <features> tag (acpi, apic, pae) I also pulled the memballoon stuff.