A total noob question about truenas scale and VMs

huseyinozsut

Dabbler
Joined
Jul 12, 2021
Messages
24
Hi,

I have been using truenas for over one year now. And wow! I am already a huge fan of it. My setup in the office is pretty amateur. Standard mainboard, i5 3570 cpu, 24gb ram, one 128gb ssd for boot drive, one 128gb ssd for cages, VM etc... I use 6 of 6TB HDD in raid10.

I also built another one for a friend. It is pretty close to my setup with an extra HBA card, 12 of 2TB HDD in raid 60 (6 of the disks are in raid 6 and there are 2 vdevs of these disk sets in one Pool). He also have a backup disk and backs up his important data every week, which is enough for him. None of us have offsite backups.

We are allways on a very tight budget due to low income. :grin: (God! I love Turkey. I like the challenge!) That is why I used 12 of 2TB disks in two sets of raid 6!! Having an extra machine in the same space is not an option for us due to our low budget. Also internet upload speeds are pretty low here (4mbit). But at last, in our region one service provider started to give an unlimited internet with 20mbit upload speed. This means, off site backups are not impossible anymore...

Therefore I am planning to setup a third Truenas machine in my home. But again, with zero budget. :grin: I have an 3770k with 16gb of ram and 4 of 4TB disks. I can setup raid 10 in it. And with 20mbit upload speeds, we can start to take offsite backups. But this PC is my media center in my living room.

********

So, here comes the question: Would it be possible to setup a VM in Truenas Scale and install Kodi (or Libreelec with Kodi) in it and can get HDMI output? This would not be possible in Truenas as I know. I read somewhere there is a problem in USB passthrough in Truenas Scale though.

Another option would be using Truenas in VM (possibly with an HBA card); but data is more important than media playing. So I would prefer media player in Truenas Scale.

Am I seeking for the impossible? Or is it possible?

**********

My aim is to use my media pc as truenas scale server with KODI media player, homeassitant supervised, inside homeassistant motioneye, and record the footage of three ip cameras of the apartment I live, all at the same time. For camera I would probably use another disk, lets say 1TB.

Power of 3770k would be more than enough for this job. 16gb ram can be a problem, but I can steal 8gigs from my office Truenas. I won't be watching anything more than 1080p, since my TV is 1080p :grin: ) In all truenas servers there is UPS. All network devices (modems, routers, switches) have handmade battery systems. All truenas devices shutdowns automatically when there is a power out (by using homeassistant).

Before starting the tests, I wanted to ask you first.
 

diogen

Explorer
Joined
Jul 21, 2022
Messages
72
Would it be possible to setup a VM in Truenas Scale and install Kodi (or Libreelec with Kodi) in it and can get HDMI output?
You'd need a discrete video card to pass through to the Kodi VM. And this runs into issues with the current state of TNS...

TrueNAS is more often used to store the media files and have them managed by Plex/Emby/Jellyfin VM.
In this case you can stream (and transcode if needed) to other computers (browsers).
Also, a discrete GPU required...
 

huseyinozsut

Dabbler
Joined
Jul 12, 2021
Messages
24
You'd need a discrete video card to pass through to the Kodi VM. And this runs into issues with the current state of TNS...

TrueNAS is more often used to store the media files and have them managed by Plex/Emby/Jellyfin VM.
In this case you can stream (and transcode if needed) to other computers (browsers).
Also, a discrete GPU required...
Thank you very much for the headsup. I have an old GPU that can be used as second GPU and I will give it a try.
 

huseyinozsut

Dabbler
Joined
Jul 12, 2021
Messages
24
Ok. Now I solved nearly all of my problems (I guess). I am writing this post to help other people trying to setup a VM on Truenas scale with passthrough hardware (like GPU, USB port). I gethered these informations from several places.

1)
First of all, to be able to set any hardware passthrough on a VM, a specification that is called VT-d is a must. Not all motherboards support VT-d. Also, not all CPUs support VT-d.

For example, Z77 chipset DOES NOT support VT-d, while H77 chipset DOES support VT-d. But that should not fool you, a motherboard with a chipset that supports VT-d may or may not support VT-d due to producer's BIOS firmware. :grin: So, you should specifically check your motherboard whether it supports VT-d.

Also, third generation K CPUs (3770k, 3570k) DOES NOT support VT-d, while 3770 or 3570 DOES support VT-d. So, don't think as "if a lower end CPU does support VT-d, mine also should". Also low end CPUs generally don't support VT-d (especially if they are old). For example 3220 does not support VT-d.

In my situation, my office server had Z77 motherboard (does not support VT-d) and 3570 cpu (does support VT-d). And my new setup had H77 motherboard (does support VT-d) and 3770k cpu (does not support VT-d). All I had to do to exchange cpus, which cost me nothing. And now, I have a system that I can enable VT-d!

Before setting up a VM you should enable Virtualization and VT-d in BIOS.

2)
As on the upper post diogen explained, although Truenas does not need a GPU to run and can startup headless, when you want to passthrough the GPU, IT DOES NOT LET YOU. So you will need a second GPU. My first GPU is onboard GPU. Second GPU is a GTX 1030. GTX 1030 is set as passthrough.
2-a) When creating a VM with GPU passthrough, Truenas will reserve the GPU for that VM. If you want to exchange GPU's, you will see that you can't. That is because that GPU is reseved. To cancel that first you should shutdown your VM. Then you should go to System settings > Advanced. You will find "Isolated GPU devices". Configure it. Remove the isolation. Now you can isolate your other GPU. Then add that GPU as GPU passthrough device in your VM setup.
3)
USB passthrough is a bit tricky. In my research, I found a command called "lspci -vnn". This lists your motherboard hardwares. On this list you should find your USB hub controllers. I had three of them and I noted their adress (or ID, I don't know the technical word, I am a total noob. I make things work with research and trial-error). For example 00:1d.0 and 00:1a.0. Then in GUI of Truenas Scale you should go to "Virtualization", shutdown your VM if it is active. Under the VM tab there is "Devices". Click that. Add device. Choose Type of the device you want to add as "PCI passthrough device". In PCI passthrough device you will see 00:1d.0 and 00:1a.0. Choose one at a time and add.

Now I get video output from my monitor and I can use my keyboard/mouse. I could not succeed to install Libreelec yet; but I guess that part will be easier to figure out.

---------------------------------

For Homeassistant I will use the app (jail). After installing Homeassistant I can install Motioneye inside it.

By this, I will have
1) Truenas server
2) KODI and HDMI output and usb input for use as media center
3) Homeassistant for my "Smart Home" projects
4) Motioneye for recording the footage of three security cameras 24/7

in one machine.
 
Last edited:

diogen

Explorer
Joined
Jul 21, 2022
Messages
72
At the risk to be called out as a language-nazi...:cool:

1.
It's VT-d, not VM-d

2.
Before setting up a VM you should enable Virtualization and Vm-d in BIOS.
If you don't need to passthrough controllers (HBA, NIC) or GPU - no need to.
Just enabling VT-x (and that is a must!) should be good enough to run VMs...
 

huseyinozsut

Dabbler
Joined
Jul 12, 2021
Messages
24
At the risk to be called out as a language-nazi...:cool:

1.
It's VT-d, not VM-d

2.

If you don't need to passthrough controllers (HBA, NIC) or GPU - no need to.
Just enabling VT-x (and that is a must!) should be good enough to run VMs...
Yes, VT-d, not VM-d. I will correct every single one of them on the original post. :grin:

And yes, VT-d is only needed when there is need for a dedicated hardware for VM. If there is no need for dedicated hardware, then there is no need for VT-d. In my situation I needed GPU and usb for media player needs.

In old mainboards VT-x is generally called "Virtualization" or "Intel Virtualization" or something like that. In newer boards I think the call it by it 's technical name: VT-x.
 
Top