# Import ZFS pool from bhyve VM



## elpek (Aug 22, 2014)

Hello!

I have a FreeBSD 10.0 machine with four disks that are split into two ZFS pools (both are two way mirrors) as follows:

zroot - where the system's root is installed
storage - where I keep all my data and backups
What I am plan*n*ing to do is to run a couple of bhyve virtual machines with zvol disk backends on zroot where one of them would need to import the storage ZFS pool. Is it possible to "pass" the whole pool to bhyve VM?


----------



## usdmatt (Aug 22, 2014)

You could probably pass the disk devices through using bhyve, then mount the pool inside the virtual machine.

From what I understand you should be able to use the ahci-hd emulation in bhyve to pass multiple block devices (i.e. the storage disks) through to the VM. They should then show up as individual disks in the VM, where you can import the pool normally. I don't know what sort of performance overhead this would have as compared to accessing the pool directly from the host. You may also be able to use virtio-blk instead.

There's actually an example of passing a bunch of disks at the end of the man page:
https://www.freebsd.org/cgi/man.cgi?que ... ormat=html

This message from one of the bhyve developers suggests that raw block devices can be used:
https://lists.freebsd.org/pipermail/fre ... 02254.html

Obviously you'll need to export the pool from the host first if it's imported. ZFS is not capable of handling two systems (host and VM in this case) accessing the same pool at the same time. It was never designed to be clustered


----------

