FreeBSD VirtIO

virtio 참고 :

So-called "full virtualization" is a nice feature because it allows you to run any operating system virtualized. However, it's slow because the hypervisor has to emulate actual physical devices such as RTL8139 network cards . This emulation is both complicated and inefficient.

Virtio is a virtualization standard for network and disk device drivers where just the guest's device driver "knows" it is running in a virtual environment, and cooperates with the hypervisor. This enables guests to get high performance network and disk operations, and gives most of the performance benefits of paravirtualization.

Note that virtio is different, but architecturally similar to, Xen paravirtualized device drivers (such as the ones that you can install in a Windows guest to make it go faster under Xen). Also similar is VMWare's Guest Tools.

This page describes how to configure libvirt to use virtio with KVM guests.

kvm 사용시 virtio Driver 를 사용할 일이 종종 있습니다.

과거에는 virtio-kmod 를 ports 에서 설치 하고  /boot/loader.conf 에 virtio_load 등을 추가 하였지만


BSD 11 에서는 바로 Disk 를 추가 하여 사용 할수 있습니다.


VirtIO Driver load

Driver load 확인을 위한것임으로 별도로 확인할 필요는 없습니다.


root@bsd11:~ # kldload virtio
kldload: can't load virtio: module already loaded or in kernel
root@bsd11:~ #

이미 kernel 에서 load 되어 있다고 나옵니다.


차후 make world 도 해봐야 겠네요. 🙂

root@bsd11:~ # cat /usr/src/sys/amd64/conf/GENERIC | grep vir
device          virtio                  # Generic VirtIO bus (required)
device          virtio_pci              # VirtIO PCI device
device          virtio_blk              # VirtIO Block device
device          virtio_scsi             # VirtIO SCSI device
device          virtio_balloon          # VirtIO Memory Balloon device
root@bsd11:~ #



VirtIO Device 확인

Disk name 은 vtbdX 형식으로 추가 됩니다.

root@bsd11:~ # ls -al /dev/vtb*
crw-r-----  1 root  operator  0x48 Mar 11 21:49 /dev/vtbd0
root@bsd11:~ #


VirtIO Disk Test

root@bsd11:~ # gpart create -s GPT vtbd0
vtbd0 created
root@bsd11:~ # gpart add -t freebsd-ufs vtbd0
vtbd0p1 added
root@bsd11:~ # newfs -U /dev/vtbd0p1
/dev/vtbd0p1: 10240.0MB (20971440 sectors) block size 32768, fragment size 4096
        using 17 cylinder groups of 626.09MB, 20035 blks, 80256 inodes.
        with soft updates
super-block backups (for fsck_ffs -b #) at:
 192, 1282432, 2564672, 3846912, 5129152, 6411392, 7693632, 8975872, 10258112,
 11540352, 12822592, 14104832, 15387072, 16669312, 17951552, 19233792, 20516032
root@bsd11:~ # mkdir /data
root@bsd11:~ # mount /dev/vtbd0p1 /data/
root@bsd11:~ # df -h | grep -i data
/dev/vtbd0p1            9.7G    8.0K    8.9G     0%    /data
root@bsd11:~ #


Last modified: 2018-03-11



Write a Reply or Comment