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
Best Answer
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 usedev="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.