[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Running a FreeBSD guest



Victor Sudakov wrote: 
> Robbi Nespu wrote:
> > On 3/23/21 10:20 AM, Victor Sudakov wrote:
> > > Dear Colleagues,
> > > 
> > > What's the minimum software kit to run a couple of FreeBSD guests
> > > (serial console, no graphics needed) on a Debian 10 host?
> > > 
> > > I don't need any fancy management GUI like that of VirtualBox, would
> > > just prefer some minimalistic hypervisor managed from the CLI. The
> > > ability to access the host's raw disk devices from the guest would be a
> > > great advantage.
> > > 
> > > Please don't just say "kvm" or any other single word but give a pointer
> > > to a good step-by-step document.
> > > 
> > 
> > I think qemu is fast and simple,
> > 
> > $ qemu-img create freebsd.img 4G
> > 
> > $ qemu-system-x86_64 -hda freebsd.img -cdrom
> > FreeBSD-12.2-RELEASE-amd64-bootonly.iso -boot d -m 512
> > 
> > do the installation and then try boot it with
> > 
> > $ qemu-system-x86_64 -hda freebsd.img -m 512
> 
> Really, a nice thing. Thank you. A couple of questions if you please:
> 
> 1. Does qemu use hardware virtualization (VT-d, whatever is in the CPU)?

If qemu-kvm is installed, yes, that will be the default. qemu
will fall back to emulation if a non-x86 guest is requested or
the CPU of the host is incapable.


> 2. Can qemu present the NIC and drives to the guest paravirtualized?
> FreeBSD understands VirtIO Block Adapter, VirtIO Ethernet and VMware
> VMXNET3 and some other paravirtualized devices.

Yes.

Most other tools for virtualization on Linux are built on top of
qemu/kvm, largely to expose features that qemu already has but
can required very long command lines, or to do management of
multiple VMs. The libvirtd infrastructure is probably the
simplest such management system. Although there is an X11 GUI
included with it, the command line tools can do everything.

Here's a typical non-libvirtd qemu/kvm invocation:

cd /var/spool/kvm
export VNAME=virtualmachinename
export CPUS=2
export RAM=4096
export MAC=00:15:f1:c1:a2:01
export VNC=:1
export IMAGE=/var/spool/kvm/images/$VNAME.img

kvm -m $RAM -smp $CPUS -name $VNAME -rtc base=utc -boot menu=on -drive file=$IMAGE,if=none,id=drive-virtio-disk0,boot=on,cache=writeback -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 -device virtio-net-pci,vlan=0,id=net0,mac=$MAC,bus=pci.0,addr=0x3 -net
tap -usbdevice tablet -vnc $VNC &


libvirtd tooling is more comprehensive, but in the end gets
invoked with

virsh start virtualmachinename

-dsr-


Reply to: