Bug 271449 - FreeBSD Handbook: re-write 'Creating a FreeBSD Guest' and 'Using ZFS with bhyve Guests'
Summary: FreeBSD Handbook: re-write 'Creating a FreeBSD Guest' and 'Using ZFS with bhy...
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-doc (Nobody)
URL: https://github.com/freebsd/freebsd-do...
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2023-05-16 11:03 UTC by Steven Friedrich
Modified: 2024-11-09 18:14 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Friedrich 2023-05-16 11:03:55 UTC
I am new to virtualization and zfs.

Could someone re-write 23.6.2. Creating a FreeBSD Guest
to use zfs instead of ufs?

Create a file to use as the virtual disk for the guest machine. Specify the size and name of the virtual
disk:
# truncate -s 16G guest.img


I read 23.6.6. Using ZFS with bhyve Guests

If ZFS is available on the host machine, using ZFS volumes instead of disk image files can provide
significant performance benefits for the guest VMs. A ZFS volume can be created by:
# zfs create -V16G -o volmode=dev zroot/linuxdisk0
When starting the VM, specify the ZFS volume as the disk drive:
# bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap0 -s3:0,virtio
-blk,/dev/zvol/zroot/linuxdisk0 \
-l com1,stdio -c 4 -m 1024M linuxguest

but can't correlate it.
I believe the vm man page states that using a zfs volume through a /dev point should be avoided.
What is best practice for a mere workstation using root-on-zfs?

It looks like these two sections were written by different people.
I know much has changed over the last two years.
Comment 1 Chris Moerz 2024-11-09 10:42:42 UTC
(In reply to Steven Friedrich from comment #0)

Hi Steven,

do you happen to remember where you read the recommendation on avoiding zvol device nodes? I'm aware it's a bit of a controversial topic, and I too have sometimes seen better performance with file backed storage instead of zvols.

We could add a remark that using file backed storage works on zfs just like on ufs?

For reference, there was a discussion on the forums a while back:
https://forums.freebsd.org/threads/how-to-set-up-storage-for-a-bhyve-hypervisor-zfs-or-ufs-for-host-guest.93383/

Appreciate your feedback - even if it's been a while...

thanks
cm
Comment 2 Pat Maddox 2024-11-09 16:38:07 UTC
There’s an article from Klara comparing the performance: https://klarasystems.com/articles/virtualization-showdown-freebsd-bhyve-linux-kvm/

Specifically the section “Finding the most performant storage configuration on bhyve”
Comment 3 Chris Moerz 2024-11-09 18:14:33 UTC
(In reply to Pat Maddox from comment #2)

Well, that settles that then, I guess. We should probably rewrite the advice to use file backed storage on datasets instead of zvols.

I'll put that on my todo list. Unless someone beats me to it, I'll look into setting up a review.