Installing FreeBSD under KVM with VirtIO

This is a public "note to self" that I hope will be useful to somebody out there.

This evening I wanted to install FreeBSD in a VM under KVM on a Linux VM-host.
Also, when I install FreeBSD with ZFS (Read: Always), I like to partition and setup the disks by hand via the "Shell" option in the installer, so that I get the GPT labels just the way I want them.

I booted up the installer image and got on my merry way, but when I got to the shell, I could not see any disks. I tried running camcontrol devlist, and it only showed the IDE adapter for the virtual CD-ROM drive. I tried looking in /dev, and there was no ada0 or da0.

I eventually ended up changing the disk to be a SCSI disk, and then I could see the disk and install FreeBSD. When I was finished, I tried switching it back to VirtIO, and the system booted up without a problem. Again, I tried running camcontrol devlist, and it showed no devices. This really had me scratching my head, because where is the system then?

Eventually, I figured out that VirtIO disks are named vtbdX and, as of FreeBSD 11.2-RELEASE, are not shown by camcontrol devlist.

So, to anybody out there in the future, who happens to share my habits:
If you are installing FreeBSD under KVM, especially if you only have a single virtual disk, the device ID you are looking for is vtbd0. Look for it in /dev, because camcontrol devlist might not list it.
 
Did camcontrol ever show virtio disks?

Does raise the question of what’s an easy way to list all available disk devices on the console, other than looking through dmesg.
 
Did camcontrol ever show virtio disks?

Does raise the question of what’s an easy way to list all available disk devices on the console, other than looking through dmesg.
Not to my knowledge, I did, of course, try a Google search, and it I noticed that in previous releases it did not list virtio devices either.

Yes, indeed, because I was really baffled, I was thinking "Does FreeBSD not support virtio?", but it was quite clear that it did.
 
Back
Top