Truenas Scale - How to mount USB into VM like W10 or Linux etc

draco76x

Cadet
Joined
Sep 5, 2021
Messages
2
Newbie here on Truenas, I just installed Truenas Scale & installed VM Win10.

I have hit a problem, intend to attached a USB drive to VM so that I can copy file.
Tried finding the PCI address on the shell using "lspci" then based on the address to create a device for passthrough but it does not work.

Anybody have any solution to get a USB mounted on VM??
Appreciate the help & advice.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Anybody have any solution to get a USB mounted on VM??

You need to pass the entire USB controller (so it has to have nothing connected to it that is used by the host OS).
 

draco76x

Cadet
Joined
Sep 5, 2021
Messages
2
Screenshot 2021-09-06 193924.jpg


Using the command "lspci -knn", I found that all the device is in use by the Kernel, is this the reason that i cannot do a pass through for the USB controller??
If yes, how to counter this issue??
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
It talks about iohyve, but the PCI part is relevant, I think:


For general reference (and giving you more clues how to make sure it goes right after a reboot (you'll need to use loader tunables, not edit the loader.conf directly):
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
Newbie here on Truenas, I just installed Truenas Scale & installed VM Win10.

I have hit a problem, intend to attached a USB drive to VM so that I can copy file.
Tried finding the PCI address on the shell using "lspci" then based on the address to create a device for passthrough but it does not work.

Anybody have any solution to get a USB mounted on VM??
Appreciate the help & advice.

You need USB passthrough not PCI passthrough, and as you've probably discovered in TRUENAS SCALE you can't add a "USB passthorugh device" to a VM.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
OK, so I for some reason never look at the breadcrumbs to see that it's SCALE and not CORE that is asked about.

My point stands... you need to pass through the PCI device which is the entire USB controller that you will connect the device to.

I don't see a barrier to that in SCALE.
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
My point stands... you need to pass through the PCI device which is the entire USB controller that you will connect the device to

Fine, it nothing else hangs off the same USB controller or it doesn't share PCI address. KVM perfectly able to pass through individual USB devices, it's just it's not implemented in TrueNAS scale.
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
USB Passthrough for VMs has been accepted as an enhancement request on Jira, so it's just a matter of when they get around to implementing it. I don't see any new activity on it so I don't believe it's even in the nightlies yet. This, along with importing/exporting virtual disks, are the last remaining "major" bits to bring a fully-realized VM management system to fruition IMHO.

You can manually attach USB devices via the virsh cli, like you would with any other KVM install, however the middleware will overwrite custom configs like this. I was not able to successfully get a Google Coral USB device, for example, to stay attached.

As others mentioned PCI passthrough is supported in the GUI so if you can pass through the entire USB controller/PCI device (i.e. nothing else is on it that you don't want dedicated to do the VM) you can do this otherwise need to wait for the beta to evolve.

USB network redirects are situational - the free projects that do this have performance issues in my experience, the paid ones (linked in previous post) are pretty expensive.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I have hit a problem, intend to attached a USB drive to VM so that I can copy file.
Can't you connect the drive to your local system and copy the file via your RDP session?
 
Top