KVM/QEMU: Windows Guest (WindowsServer) add new drive with attach disk SSD

akira2x3x asked:

I would like to add a new drive to my Windows Guest (Windows Server 2016). Let’s say D:

I can not use network share(SAMBA,etc…). It is why I am trying to add new storage device.

add in myVM.xml

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/Windows.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdb' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
=>    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/disk/by-uuid/e3645a19-08dd-4ad4-8b0c-24a8a7e4962d'/>
      <target dev='hdc' bus='ide'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>

-restart VM

=>Nevertheless no new hard drive in my Windows server guest

NB : harddrive is SSD nvme on PCIExpress,source dev=/dev/nvme0n1p1 (NTFS partionned).

How to add a harddrive/partition on Linux host (qemu configuration file) to be able to use it from my Windows Server Guest?


My answer:

You made a virtual hardware change which requires the VM to be fully shut down (not just rebooted) before it takes effect.

BTW: For reasons of performance you should install the Virtio-SCSI driver in the guest OS, add the Virtio-SCSI controller to the virtual hardware, and convert your disks to use SCSI instead of IDE. And switch your virtual CDROM to SATA. Ideally you should have done this during installation; here is a guide for doing so.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.