Extend the system partition in a Windows virtual machine running within kvm with file-based virtual disk

The post Extend the system partition in a Windows virtual machine running within kvm/lvm is applicable if the virtual disk is on a LVM volume.

If the virtual disk is file-based, these are the required steps:

  1. Find out what is the file the virtual machine disk is attached to; assuming disk images are in /var/lib/libvirt/images:
    sudo grep 'var.lib.libvirt.images' /etc/libvirt/qemu/name_of_virtual_machine.xml
    
You might see something like:

  ```
  <source file='/var/lib/libvirt/images/w7_64_cdev15.dd'>
  ```
  1. Shut down the virtual machine
    • Resize the disk image file:

      sudo qemu-img resize /var/lib/libvirt/images/w7_64_cdev15.dd +10G
      
    • Restart the VM

    • Extend the disk using the guest operating system specific tool; with Windows 7 and later use the extend command from within disk manager (should require no reboot).