Passthrough hard drive to VM?


Recommended Posts

Couldn't find this in the forums and sorry if it's been asked before.

 

My question is this: I want a windows 10 gaming VM and I want to passthrough my NTFS to it drives I brought over from my other system, is this possible?

 

Thanks!

I *believe* (could be wrong) that you would have to passthrough an entire controller to accomplish this.
Link to comment

Yes you can add a disk to your vm either whole disk or just a partition. I have a mythbuntu vm with a 2.5" 750GB drive added for tv recording and live tv buffer. I added the whole disk. By doing this I could manipulate partitions. I created a partition and formatted it to jfs. You should be able to mount your ntfs partitioned drives.

<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/disk/by-id/ata-WDC_WD7500BPKX-00HPJT0_WD-WXL1E84AK1MK'/>
      <target dev='hdd' bus='virtio'/>
    </disk>

 

You could change it to

ata-WDC_WD7500BPKX-00HPJT0_WD-WXL1E84AK1MK-part1 for partition 1 only.

  • Like 2
Link to comment

If you put that in for the storage location on the create VM page

Does it have to be the create VM page? Can it be done on the edit vm page/XML edit that can survive the edit vm page.

 

Edit: I should just try this stuff out more... confirmed all you need to do is enter the /dev/disk/by-id/ata-insertdevicehere and it works perfectly :)

Link to comment

I tried passing through an unassigned usb disk to an osx vm as the primary disk.

It was a clone of the startup disk of my macbook pro. I wanted to see if i could "transfer" my macbook pro and all programmes and settings to an unraid vm.

Well my identification was External_USB_3.0_2012040931753. When i specified this it gave error that it wasnt valid and vm wouldnt start.

 

I saw the disk was marked as sda. So i did it like this. (I had to change bus to sata for osx)

 

<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/sda'/>
      <target dev='hdd' bus='sata'/>
    </disk>

 

The vm booted straight into my macbooks os!!

  • Like 2
Link to comment
  • 2 years later...
On 4/12/2016 at 8:49 PM, jonp said:

You can do this without even needing to edit XML.  You do have to know the /dev/disk/by-id/ full path, but if you put that in for the storage location on the create VM page, it will pass through the entire device or just the partition (your choice).

 

How exactly could I passthrough just a partition? So I guess it should be possible to partition a single SSD drive (for example 240GB split in 1. 120GB and 2. 120GB) and then use one partition for a Windows vm and the other one for a Mac vm?

Link to comment

Partitions have a -part1 at the end of the name for the first partition.  I suspect partition 2 would be -part2 etc... but I've never used anything but a single partition on my drives with unRAID so I can't confirm this.

 

So for my PNY SSDs I would use ata-PNY_CS2211_960GB_SSD_PNY381621931203001D7-part1 to get the 1st partition for the first drive:

root@VMServer:/dev/disk/by-id# ls ata-PNY*
ata-PNY_CS2211_960GB_SSD_PNY381621931203001D7@
ata-PNY_CS2211_960GB_SSD_PNY381621931203001D7-part1@
ata-PNY_CS2211_960GB_SSD_PNY3816219312030022C@
ata-PNY_CS2211_960GB_SSD_PNY3816219312030022C-part1@

I.E. the full path in the GUI would be: /dev/disk/by-id/ata-PNY_CS2211_960GB_SSD_PNY381621931203001D7-part1 to the first partition on the first drive above.

Edited by BobPhoenix
Link to comment
  • 2 months later...
  • 9 months later...

I am facing a couple issues right now. I have a NVME i have passed trough to a Windows VM. So far so good, no issues with passing through the whole controller. But if I passthrought the whole controller, all partitions of that disk aren't available for other VMs anymore. My idea was to have 100GB of that NVME available for a Linux distro (dual boot) in my case PopOS. In the documentation of PopOS for dual boot they stated "select the OS you wanna boot from the boot menu".

 

The problem is during the boot process the OVMF Bios isn't accesible with the passed through USB Keyboard and mouse. I have no chance to select which efi partition I wanna use for booting. I guess with VNC this isn't a issue, but with a GPU only passthrough at this stage there are no device drivers for the keyboard loaded. Does this change if I passthrough a whole USB controller? Will the keyboard work in this case, someone maybe tried this or has a setup and can check before I messup my complete setup?

 

Another question: What happens if I pass through a xxxx-devive-part2 partition to a VM and install a OS on it? During the process the partition is split into a efi partition, swap, root and home partition. Did I end up in a scenario, where I have to adjust the XML later to add the partitions 3, 4, and 5 back in? And how is the performance compared to controller passed through if I choose a partition and set it to SCSI to have trim still working?

 

My current Win10 VM is setup, if I reboot the Server and boot it straight from the NVME, all drivers are installed for a bare metal use and everthing is working. Just in case I need all the cores or I have to check the Unraid stick for errors. I only have that one box. If I have the PopOS installed on the same NVME during the boot I see the second efi partition and can select it in the motherboards bios. Same keyboard, same USB port. Maybe there is a way to have a earlier access to the passed through keyboard in a Q35 OVMF VM somehow that I'am missing. 

 

Any help or ideas are highly appreciated!

Link to comment
  • 1 year later...
  • 3 months later...

Hello! Any kind of help here?

I want to pass through my whole SAS drive to the VM. In my case it is the "sdd" disk. But It does not find the sdd, here is how I tryed to do it:

<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/sdd'/>
      <target dev='hdd' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>

 

Thanks in advance!

Link to comment

Oh! I didn't see that, it makes sense, however, I still can not see the full hard drive, not even in drive administration.

 

Isn't there anything else needed?

 

<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/sdd'/>
      <target dev='hdd' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>
 

Edited by rojarrolla
Link to comment
18 hours ago, rojarrolla said:

however, I still can not see the full hard drive, not even in drive administration

Sorry I never tried directly, so you need to wait for someone else.

What do you mean by drive administration?Unraid?

Did you setup the scsi controller in the vm?

Check also other code snippets in this thread, you could try the "by-id" path, or change controller to sata.

  • Like 1
Link to comment
20 hours ago, ghost82 said:

Sorry I never tried directly, so you need to wait for someone else.

What do you mean by drive administration?Unraid?

Did you setup the scsi controller in the vm?

Check also other code snippets in this thread, you could try the "by-id" path, or change controller to sata.

Hi! Ghost!

 

Sorry If Im confusing you. I meant in "windows drive manager".

 

Allow me to be more specific, this is my hardware:

Dell T420 Server

Dell Perc H310 SCSI card Flashed to LSI

E5-2470 V2 Processor 

16GB Ram
4 X 10 Tb Seagate drives.

I don't know if passing through the SCSI Card is a good Idea because, as I have seen, while the VM is Working, Unraid won't have access to it. And the pont is to enable the win10 VM (or maybe 7 to be lighter) to run Blue Iris CCTV software. I could make the Virtual drive bigger, but It will make the array to be continuously writing to the disks.

You mention to try the controller to SATA, i think I already did that. I can do it again to see.
 

By Id you mean that I should try it like this?
 

<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/mnt/disks/IBM-ESXS_ST10000NM0226_E'/>
      <target dev='hdd' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>


If so, it doesn´t work. I'll also keep searching and testing.


 

Link to comment
On 9/23/2020 at 1:55 PM, ghost82 said:

Sorry I never tried directly, so you need to wait for someone else.

I wanted to write this post, so maybe this thread can be closed and marked as "SOLVED".

Thanks to Ghost82 I managed to pass through a complete SAS drive as a SATA drive to my Windows10 VM, so here I'm leaving the text from my XML file so you can have an idea of how to do it since I think many of you have SAS cards and Drives in your servers.

Some have written aids to pass through sata drives, and this is to pass through a SAS drive, as Ghost82 said it can be done with the "by-id" path. 

I think these lines should be good for many servers:

<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/disk/by-id/scsi-35000c50086b39343' index='3'/>
      <backingStore/>
      <target dev='hdd' bus='sata'/>
      <alias name='sata0-0-3'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>

In this case, "scsi-35000c50086b39343" is the name of my drive, you should find yours in your "/dev/disk/by-id/" folder by typing "ls -la" and you will see all your drives in Unraid, it is very easy. and replace the name of the drive. 

Bear in mind my hardware, I have a dell PERC H310 Flashed to LSI, however if you have this or another kind of SCSI card, these lines should be good for you too.

Should you have more questions, don't hesitate to ask!

 

Cheers!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.