17 August 2016

AHCI controller passthrough with a Supermicro Xeon-D motherboard

So someone asked me if it is possible to passthrough the onboard AHCI SATA controller from a Supermicro Xeon-D motherboard to a VM. Since I use ESXi, that's what I'll use to show you this. Hyper-V 2016 features discrete device assignment in the latest technical preview builds, you can try this with Hyper-V too. Maybe I'll do a blogpost on that some other time.

I started by having a look in the list of devices that are available for passthough. The Lynx Point AHCI Controller was not on the list of devices since SATA controllers are unsupported for passthrough. Let's fix that!

Log in to your host using SSH or use the DCUI locally.
Find out the PCI ID using the following command:
esxcli storage core adapter list

Your onboard SATA controller is usually listed as vmhba0. The ID we're looking for is listed in the Description. So in this case, it's 0000:00:1f.2.

Enter the next command to find the PID. Substitute the PCI ID with your own ID if needed.
lspci -n | grep 0000:00:1f.2
In this case, the PID we're looking for is 8c02. Add this PID at the bottom of /etc/passthrou.map like so.
Save your changes and reboot the ESXi host.

After the reboot, you'll be able to select the Lync Point AHCI controller.

Mark the device for passthrough and reboot the host.

When the host is up again, edit the VM settings to add the PCI device.


After adding the PCI device to the VM, boot it to see the result.












In my case, the VM I added the controller to is a Windows 7 virtual machine. To show you the controller and the connected disks, I added a screenshot of the device manager. I have two Samsung 850 Pro SSDs connected to the onboard SATA controller.
Reminder: Since the files for the VM itself have to be stored somewhere, you'll need another storage device. In my case, all the VM files are stored on an NVMe SSD. This method can be used to create a dedicated storage VM with a number of hard drives. It's a great way to give a FreeNAS VM direct access to a number of SATA drives.

Many thanks to Hilko for showing me the commands in the "Energy efficient ESXi server" thread on got.tweakers.net. Most of this blogpost is a shameless copy of his post.

3 comments:

  1. A hypothetical question: Would it then also be possible to install Freenas on one of the sata drives that are passed through via the AHCI controller, instead of on the datastore. (Provided there is still a datastore for VMWare to be able to add the VM) In such a scenario, when the esxi boot drive is removed, the system would still boot Freenas from the SATA drives as if there was no virtualization at all. Correct?

    ReplyDelete
  2. Yes you can. As long as you keep a bootloader on a virtual disk since a VM cannot boot from a passthrough controller. The baremetal FreeNAS system can boot normally if you make sure you have a second bootloader for the baremetal use case.

    ReplyDelete
  3. I've had FreeNAS running for over a year using passthrough on an X9SCL-F without a single issue. However, older boards like mine have a discrete northbridge controller, and thus don't require this workaround. I actually thought this was impossible to do with an SoC (no discrete north or southbridge chips). Thanks for the guide!

    ReplyDelete