0

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

  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <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>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
=>    <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'/>
      <shareable/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <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>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <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>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>

-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?

Thanks

0

You don't say whether the original pre-existing disks in the guest XML are using IDE or SCSI or VirtIO. Since you do say Windows doesn't recognise the newly added VirtIO disk though, I'm going to presume that your existing disks are IDE or SCSI, and that Windows thus does not have the VirtIO drivers installed.

If this is the case, then you can either change the <target/> to use dev="hdb" bus="ide", or instead install the Windows VirtIO Drivers (https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html). Note though I'm not 100% sure if the VirtIO drivers are supported on Windows 2016 as I've not tried such a new version of Windows myself.

  • Harddrive is SSD nvme. so my source dev=/dev/nvme0n1p1. Bus is PCI-Express. But for test purpose in the first place any generic working solution would be fine. My windows guest is a Windows Server. – akira2x3x Apr 5 at 11:51
  • That is what your host harddrive is. I was asking what your original guest harddrive is in the XML – DanielB Apr 5 at 13:39
  • As I wasn't sure about what you ask, I send a part of the xml in the original post. NB : My Host and My Guest (qcow2) are in RAMDisk. I am using a physical hard drive for backup purpose of my windows Guest. – akira2x3x Apr 5 at 14:10
  • Your XML shows you were using IDE for the original root disk. It isn't possible to hot-plug IDE disks using "virsh attach-device", so if you need that you'll have to use virtio and install the Windows virtio drivers. – DanielB Apr 5 at 14:48
  • Thanks for your help. I am not using virsh attach-device anymore.(to clarify my problem I exclude it from my original post). I stay focused on qemu xml conf file. Windows Guest works fine (only C:(my image) an D:\cdrom appears) – akira2x3x Apr 5 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.