First off, let me say that I know that this isn't generally recommended and you need pretty beefy hardware to achieve this but I figured I'd give it a try as a learning experience, but I'm running into some issues and I'm wondering if they're hardware or software issues. I'm only really using this until FreeNAS 10 comes out in (hopefully!) 6 months since I need a beefy virtualization solution and NAS all in one (FreeNAS 9.3 wasn't working out for me so I switched to Linux, haven't really tried bhyve in 9.10 yet). I know the devs test FreeNAS in VMware, there was a blog post about virtualizing FreeNAS, and also during my research I found a complete guide on
how to virtualize FreeNAS but I'm still running into an issue, most likely with PCI Passthrough of my HBA.
I have ESXi 6 installed onto a 150 GB WD Raptor (since USB drives were giving me issues) and have the remaining space turned into a datastore, which hosts FreeNAS 9.10. I had no issues installing FreeNAS, nor do I have issues running FreeNAS by itself (besides a few random errors about NFS and Samba errors in the config, both protocols still work fine though), the problem starts when I boot up another VM.
For example, I have allocated and locked 32 GB of RAM for FreeNAS 9.10 and I have my IBM ServeRAID M1015 HBA passed through to the VM, I boot up and there are no errors. I transfer a huge file over SMB and there aren't any issues. I create a 6 GB archive (from a folder that exists on the share) over SMB and there aren't any issues. Yet, as soon as I start up my Usenet VM (contains Sickrage, Couchpotato, etc...) FreeNAS starts throwing CAM status errors (ATA 41 IIRC), which are visible in the vmkernel logs of ESXi. Initially I thought this was related to NFS since it seems fine with SMB, so I commented out all the shares in /etc/fstab and rebooted but still got the same errors. The Usenet VM resides in an iSCSI zvol on FreeNAS so I figured maybe there was too much IO so I moved the Usenet VM to another Raptor, which is attached directly to ESXi, but still received the errors!
There shouldn't be any issues with RAM because I've only allocated 8 GB of RAM to the Usenet VM, which would leave 23 GB of RAM completely untouched and available to ESXi (would actually be around 30 available since usenet only uses about 1 GB). I've researched this a bit and it seems that other people have been having these issues for a while (PCI passthrough of an HBA), and some people recommended changing the driver used for the passthrough, but I don't know how to go about doing that. The CAM Status errors also appeared if I passed through the HBA before I had installed FreeNAS, they would appear while the OS is installing to the desired drive (not connected to the HBA).
I have yet to complete further testing (in progress now), but my initial conclusion is that there is a problem with PCI passthrough, but why would it work fine with SMB but barf up errors at other points which seemingly have nothing to do with it? All in all, it
does work since I had 5 VMs (FreeNAS, Plex, Usenet, Usenet 2( which contains another plex server) and my webserver) running, Usenet was successfully doing what it should be doing, data was being transferred to the appropriate pools and was accessible from Kodi. It just looked like the process was getting bottlenecked due to the controller screwing up. Other things would screw up, which I'm not sure if they're related or not, such as services failing to start in the usenet vm (it would hang indefinitely after
sudo systemctl start sickrage, even once it was outside of the zvol, it worked perfectly minutes before and nothing had been changed.)
I'm currently in the process of setting up an Arch Linux VM w/ZoL to see if the problem is BSD, but for some reason it won't let me outside of my local network. I think I've scrambled my brain after days of messing with this for 10-12 hours at a time....