Ninja Nichols

The discipline of programming

Clone Windows Server 2008 KVM Virtual Machine

I recently needed to make several copies of an already configured Windows Server 2008 virtual machine. We are using the Linux KVM hypervisor library libvirt. These are the steps I took:

  1. Run Sysprep on the existing Windows Server 2008 to clear out any unique info such as IP address and hostname that might cause interference later.
    1. Run C:WindowsSystem32SysprepSysprep.exe
    2. Select “System Out-of-Box Experience (OOBE)”
    3. Check “Generalize” and select “Shut Down” from the drop down.
  2. Once the machine has shut down, clone the virtual machine:
    1. Run the command:
      virt-clone --original Server1 --name Server2 --file /var/lib/libvirt/images/Server2.img

      where --original is the name of the virtual machine to be cloned (You can get the list of names by running virsh list --all), --name is the name of the new virtual machine and --file is clone image to be created.

  3. Rinse and repeat as needed.
  4. Start the clones and give them computer names and IP addresses.