Now Reading
FreeBSD Bhyve Virtualization | ????????????????????????????????

FreeBSD Bhyve Virtualization | ????????????????????????????????

2023-08-17 21:05:14

The Bhyve FreeBSD hypervisor (known as/spelled ‘beehive’ often) was created nearly 10 years in the past. Proper now it gives pace and options that different comparable options present – comparable to KVM/VMware/XEN. You’ll be able to test all the small print within the FreeBSD Handbook for particulars. One of many final issues Bhyve lacks is so known as dwell migration between bodily hosts however save state and resume from saved state are within the works at present so not lengthy earlier than that dwell migration. Up till just lately I used principally VirtualBox for my small virtualization wants. Not too long ago I began to guage Bhyve and this time I’m more than happy – the FreeBSD VirtualBox integration isn’t excellent anyway – for instance – the USB passthru doesn’t work since a number of years – and even when it labored – it was restricted to USB 1.x speeds solely. Additionally due to FreeBSD coverage of pkg(8) packages constructing course of – the VirtualBox packages stay damaged for 3 months after every *.1 or higher launch (*.2/*.3/…). The opposite impulse that pressured me to change from VirtualBox to Bhyve was the VirtualBox (in)stability. I typically wanted to restart crashed VirtualBox VMs as a result of they failed for some unspecified cause.

One of many Bhyve options that I particularly appreciated was that by default Bhyve solely makes use of reminiscence that visitor system wished to allocate. For instance a FreeBSD digital machine with 2 GB RAM set will use after boot about 70 MB RAM ????

One other nice function I actually appreciated about Bhyve was that I may droop the host machine with all of the VMs began – each on my ThinkPad W520 laptop computer and AMD Based FreeBSD Desktop after which all of it efficiently resumed. With VirtualBox you would need to poweroff all VMs as a result of if you happen to droop with operating VirtualBox VMs – it’s going to simply crash – its not potential to do droop/resume cycle with VirtualBox.

The Desk of Contents for this text is as follows:

  • FreeBSD Bhyve Virtualization
  • Bhyve Managers
  • Bhyve versus KVM and VMware
  • Bhyve libvirt/virt-manager GUI
  • vm-bhyve
    • Set up/Setup
    • Networking
      • Server/Desktop LAN Bridge
      • Laptop computer WiFi NAT
      • Networking Restart
    • Datastores
    • Templates
    • NVMe
    • ISO Pictures
    • Visitor OS Set up
      • FreeBSD
      • Linux
      • Home windows 7
      • Home windows 10
        • Pressure Home windows 10 Offline Account
        • Home windows 10 Bloat Removers
      • Home windows 11
    • Coping with Locked VMs
    • Disk Resize
  • Abstract

Whereas VirtualBox has fairly usable QT primarily based GUI – the Bhyve doesn’t have something like that. I as soon as seen some GUI QT prototype for Bhyve however it was very primary – so overlook about that at present. There are nevertheless a number of net interfaces comparable to TrueNAS CORE or CBSD/CloneOS. There are additionally a number of terminal managers comparable to vm-bhyve. The older one iohyve has not been maintained for at the least 6 lengthy years. There may be additionally libvirt Bhyve driver however extra on that later.

Klara Techniques in contrast Bhyve to KVM and Benjamin Bryan in contrast it towards VMware hypervisor. Whereas Bhyve stays aggressive towards each of them there are two essential points from Klara Techniques that stand out and are price repeating right here.

First – utilizing nvme driver is lots sooner then utilizing extra conventional virtio-blk or ahci-hd backends.

bhyve-nvme

Second – and this one appears unusual – utilizing a uncooked file is quicker then utilizing ZFS zvol system.

bhyve-raw-zvol

To summarize these ideas – simply simply file on a disk like disk0.img and use nvme as storage backend everytime the visitor working system helps it.

Theoretically the libvirt virtualization API helps Bhyve as certainly one of its backends and the small print about Bhyve driver – https://libvirt.org/drvbhyve.html – can be found right here. I’ve tried it with virt-manager and after some primary configuration I used to be capable of begin FreeBSD 13.2 set up … however it acquired frozen on the kernel messages and nothing extra occurred.

virt-manager-boot-menu

… and the second it hanged under. I’ve tried a number of instances with the identical impact.

virt-manager-hang

I actually appreciated the digital machine settings window of virt-manager.

virt-manager-machine-settings

Whereas You should utilize Bhyve instantly with bhyve(8) and bhyvectl(8) instructions – which I used to be doing prior to now – after attempting the vm-bhyve each on the desktop and server area – I actually appreciated it and that is what I at present use. I simply moved from vm-bhyve bundle to the newer vm-bhybe-devel one.

The vm(8) command is straightforward and supplies all wanted use circumstances.

host # vm assist
vm-bhyve: Bhyve digital machine administration v1.6-devel (rev. 106001)
Utilization: vm ...
    model
    init
    set [setting=value] [...]
    get [all|setting] [...]
    change checklist
    change information [name] [...]
    change create [-t type] [-i interface] [-n vlan-id] [-m mtu] [-a address/prefix-len] [-b bridge] [-p] 
    change vlan  
    change nat  
    change non-public  
    change add  
    change take away  
    change destroy 
    datastore checklist
    datastore add  
    datastore take away 
    datastore add  
    checklist
    information [name] [...]
    create [-d datastore] [-t template] [-s size] [-m memory] [-c vCPUs] 
    set up [-fi]  
    begin [-fi]  [...]
    cease  [...]
    restart 
    console  [com1|com2]
    configure 
    rename  
    add [-d device] [-t type] [-s size|switch] 
    startall
    stopall
    reset  [-f] 
    poweroff [-f] 
    destroy [-f] 
    passthru
    clone  
    snapshot [-f] 
    rollback [-r] 
    iso [url]
    img [url]
    picture checklist
    picture create [-d description] [-u] 
    picture destroy 
    picture provision [-d datastore]  

Set up/Setup

We want solely a number of packages so as to add.

host # pkg set up -y 
         vm-bhyve-devel 
         uefi-edk2-bhyve-csm 
         bhyve-firmware 
         edk2-bhyve 
         dnsmasq 
         grub2-bhyve 
         tigervnc-viewer 
         rdesktop

The setup is fairly straightforward additionally.

First we have to add a number of vm_* settings into the primary FreeBSD /and so forth/rc.conf file.

  vm_enable=YES
  vm_dir="zfs:zroot/vm"
  vm_list=""
  vm_delay=3

Needless to say you’ll later use the vm_list="" for the checklist of VMs that you just want to be began at boot. Like vm_list="freebsd13 freebsd14uefi" for instance. Then the vm checklist command would place [1] in on the freebsd13 title (as its first) and [2] within the freebsd14uefi title as this one is second on the checklist. See under.

host # vm checklist
NAME           DATASTORE  LOADER     CPU  MEMORY  VNC           AUTO     STATE
almalinux8     default    uefi       2    2G      0.0.0.0:5908  No       Working (11819)
freebsd13      default    bhyveload  1    256M    -             Sure [1]  Working (2342)
freebsd14      default    bhyveload  1    256M    -             No       Stopped
freebsd14uefi  default    uefi       2    8G      -             Sure [2]  Working (35394)
windows10      default    uefi       2    2G      -             No       Stopped
windows7       default    uefi       2    2G      -             No       Stopped

We have to create a devoted ZFS dataset for our VMs. You can too use listing on UFS – test vm-bhyve documentation.

host # zfs create -o mountpoint=/vm zroot/vm

We may also copy the out there templates to our new /vm dir.

host # cp -a /usr/native/share/examples/vm-bhyve /vm/.templates

Bear in mind to test /vm/.templates/config.pattern because it has the documentation for all out there choices.

host # head -12 /vm/.templates/config.pattern
# It is a pattern configuration file containing all supported choices
# Please don't attempt to use this file itself for a visitor
# For any choice that accommodates a quantity within the title, comparable to "network0_type",
# you may add extra gadgets of that kind by creating a brand new set of
# variables utilizing the subsequent quantity in sequence, e.g "network1_type"
#
# Please make certain all choice names are laid out in lowercase and
# at the start of the road. If there's any whitespace earlier than
# the choice title, the road shall be ignored.
# The '#' character signifies the beginning of a remark, even inside
# double-quotes, and so can't be used inside any values.

We will now begin initialize the vm-bhyve.

host # service vm begin

Networking

There as many community setups as many FreeBSD has community capabilities – lots! I this information I’ll cowl two most common community setups for Bhyve. One can be probably the most server (or desktop) oriented – because it requires a LAN card for use. The opposite one I might name a laptop computer one – that one would offer community connectivity utilizing wlan0 WiFi interface.

Regardless of which one we’ll select – we have to allow port forwarding on our FreeBSD host. Try this with these two instructions.

host # sysrc gateway_enable=YES

host # sysctl web.inet.ip.forwarding=1

host # echo web.hyperlink.faucet.up_on_open=1 >> /and so forth/sysctl.conf

host # sysctl web.hyperlink.faucet.up_on_open=1

I assume that our FreeBSD host system would use 10.0.0.10/24 IP deal with and that 10.0.0.1 can be its default gateway.

Your host system major /and so forth/rc.conf file can appears to be like as follows then.

host # cat /and so forth/rc.conf
# NETWORK
  hostname=host
  ifconfig_re0="inet 10.0.0.10/24 up"
  defaultrouter="10.0.0.1"
  gateway_enable=YES

# DAEMONS
  sshd_enable=YES
  zfs_enable=YES

# BHYVE
  vm_enable="YES"
  vm_dir="zfs:zroot/vm"
  vm_list=""
  vm_delay="3"

Server/Desktop LAN Bridge

We’ll use 10.0.0.0/24 community – the identical that our host system makes use of. We’ll want one bridge/change named vm-public with none deal with on it. Details about the switches is saved within the /vm/.config/system.conf file.

host # vm change create public

host # vm change checklist
NAME    TYPE      IFACE      ADDRESS      PRIVATE  MTU  VLAN  PORTS
public  customary  vm-public  -            no       -    -     -

host # cat /vm/.config/system.conf 
switch_list="public"
type_public="customary"

To be sincere the networking half setup is full.

When you’ll be establishing your Bhyve VMs you’ll both use static 10.0.0.0/24 IP deal with area or simply use DHCP and the one that’s already in your community will deal with the remaining (assuming you’ve got one).

In case you wouldn’t have one you could use dnsmasq service to do this simply.

host # cat /usr/native/and so forth/dnsmasq.conf
port=0
no-resolv
server=1.1.1.1
except-interface=lo0
bind-interfaces
local-service
dhcp-authoritative
interface=vm-public
dhcp-range=10.0.0.69,10.0.0.96

host # service dnsmasq allow

host # service dnsmasq begin

That ought to do.

Laptop computer WiFi NAT

This is without doubt one of the circumstances the place VirtualBox has another function over Bhyve. With VirtualBox its potential to make use of bridge mode over WiFi interface. Its not potential with Bhyve at present. I’ve submitted a proposal to FreeBSD Basis to implement such configuration – particularly as open supply VirtualBox code already exists. Time will inform if it is going to be applied or if there can be extra essential duties to deal with.

We’ll use 10.1.1.0/24 community for our VM wants. We may also want just one vm-bhyve change that we’ll use – and it is going to be the vm-public one with 10.1.1.1/24 deal with – we shall be utilizing it as a gateway for our VMs in NAT. Details about the switches is saved within the /vm/.config/system.conf file.

host # vm change create -a 10.1.1.1/24 public

host # vm change checklist
NAME    TYPE      IFACE      ADDRESS      PRIVATE  MTU  VLAN  PORTS
public  customary  vm-public  10.1.1.1/24  no       -    -     -

host # cat /vm/.config/system.conf 
switch_list="public"
type_public="customary"
addr_public="10.1.1.1/24"

Now the NAT half – we’ll try this with quite simple pf(4) config.

host # cat /and so forth/pf.conf
# SKIP LOOPBACK
  set skip on lo0

# bhyve(8) VMS NAT 
  nat on wlan0 from {10.1.1.1/24} to any -> (wlan0)

# PASS IN/OUT ALL
  go in all
  go out all

host # service pf allow

host # service pf begin

You’ll be able to test the stats of that pf(4) guidelines like that.

host # pfctl -Psn -vv
No ALTQ help in kernel
ALTQ associated capabilities disabled
@0 nat on wlan0 inet from 10.1.1.0/24 to any -> (wlan0) round-robin
  [ Evaluations: 18774     Packets: 362277    Bytes: 352847937   States: 0     ]
  [ Inserted: uid 0 pid 69837 State Creations: 38    ]

Be at liberty so as to add all of your pf(4) guidelines into the /and so forth/pf.conf file.

Now the DHCP server. For simplicity of the setup we’ll use dnsmasq daemon – however nothing prevents you from establishing a Highly Available DHCP Server as an alternative utilizing isc-dhcp44-server bundle.

host # cat /usr/native/and so forth/dnsmasq.conf
port=0
no-resolv
server=1.1.1.1
except-interface=lo0
bind-interfaces
local-service
dhcp-authoritative
interface=vm-public
dhcp-range=10.1.1.11,10.1.1.99

host # service dnsmasq allow

host # service dnsmasq begin

Now you ought to be able to setup Bhyve VMs in your laptop computer.

Networking Restart

Typically – when for instance you laptop computer will boot with out community connectivity – the faucet(4) interfaces typically don’t went UP.

bhyve-networking-restart

There may be easy repair tor that drawback – bhyve-network-restart.sh script.

Its proven under.

# ADD IP ADDRESS TO EACH vm-bhyve SWITCH
vm change checklist 
  | sed 1d 
  | whereas learn NAME TYPE IFACE ADDRESS PRIVATE MTU VLAN PORTS a0 a1 a2 a3 a4 a5 a6 a7 a8 a9
    do
      if [ "${ADDRESS}" != "-" ]
      then
             vm change deal with ${NAME} ${ADDRESS}
        echo vm change deal with ${NAME} ${ADDRESS}
      fi
    completed        

# SET TO 'up' ALL vm-bhyve SWITCH MEMBERS
vm change checklist 
  | sed 1d 
  | awk '{print $1}' 
  | whereas learn SWITCH
    do
      ifconfig vm-${SWITCH} 
        | awk '/member:/ {print $2}' 
        | whereas learn INTERFACE
          do
                 ifconfig ${INTERFACE} up
            echo ifconfig ${INTERFACE} up
          completed
    completed


Execute it everytime you misplaced connectivity along with your VMs and you might be completed.

Datastores

Whereas vm-bhyve helps a number of datastores – you’ll solely want one – the default one.

host # vm datastore checklist
NAME            TYPE        PATH                      ZFS DATASET
default         zfs         /vm                       zroot/vm

Snapshots and Clones

The vm-bhyve additionally helps snapshots and clones of the VMs disks. Usually they’re simply ZFS snapshots and clones.

Templates

Whereas vm-bhyve comes with a number of useful templates – they’re incomplete – and small a number of adjustments makes the sport extra playable.

NVMe

First – we’ll implement the issues that we all know work sooner – the nvme kind for disk photos as an alternative of virt-blk or ahci-hd ones. After all not all working programs have help for such gadgets – for them we’ll use the latter choices.

A quick strategy to change it to nvme is under.

host # sed -i '' s.virtio-blk.nvme.g /vm/.templates/freebsd.conf

ISO Pictures

Every VM wants an ISO picture from which it is going to be put in. After all you may also simply create new VM and replica the disk contents from different server or use one of many FreeBSD photos.

There are two methods to feed vm-bhyve with ISO photos.

One is to fetch them from some URL.

host # vm iso http://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/13.2/FreeBSD-13.2-RELEASE-amd64-disc1.iso

host # vm iso
DATASTORE           FILENAME
default             FreeBSD-13.2-RELEASE-amd64-disc1.iso

The opposite manner is to only easy copy ISO file to the /vm/.iso listing.

host # cp /residence/vermaden/obtain/ubuntu-mate-23.04-desktop-amd64.iso /vm/.iso/

host # vm iso
DATASTORE           FILENAME
default             FreeBSD-13.2-RELEASE-amd64-disc1.iso
default             ubuntu-mate-23.04-desktop-amd64.iso

Visitor OS Set up

Usually every VM set up could be very comparable as proven under.

host # vm create -t TEMPLATE NAME

host # vm set up MAME ISO

host # vm console NAME

Instance for FreeBSD is under.

host # vm create -t freebsd freebsd13

host # vm set up freebsd13 FreeBSD-13.2-RELEASE-amd64-disc1.iso
Beginning freebsd13
  * discovered visitor in /vm/freebsd13
  * booting...

host # vm console freebsd13

You’ll in all probability see one thing like that under.

freebsd-loader-menu

You then do the set up within the textual content mode and after reboot you’ve got your operating FreeBSD VM.

host # vm checklist
NAME          DATASTORE  LOADER     CPU  MEMORY  VNC  AUTO     STATE
freebsd13     default    bhyveload  1    256M    -    Sure [1]  Working (85315)

Some extra information to show could be proven with information argument.

host # vm information freebsd13
------------------------
Digital Machine: freebsd13
------------------------
  state: stopped
  datastore: default
  loader: bhyveload
  uuid: a91287a1-39d3-11ee-b73d-f0def1d6aea1
  cpu: 1
  reminiscence: 256M

  network-interface
    quantity: 0
    emulation: virtio-net
    virtual-switch: public
    fixed-mac-address: 58:9c:fc:0b:98:30
    fixed-device: -

  virtual-disk
    quantity: 0
    device-type: file
    emulation: nvme
    choices: -
    system-path: /vm/freebsd13/disk0.img
    bytes-size: 21474836480 (20.000G)
    bytes-used: 885089280 (844.086M)

  snapshots
    zroot/vm/freebsd13@recent    85.2M   Mon Aug 14 11:18 2023

host # env EDITOR=cat vm configure freebsd13
loader="bhyveload"
cpu=1
reminiscence=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"
uuid="a91287a1-39d3-11ee-b73d-f0def1d6aea1"
network0_mac="58:9c:fc:0b:98:30"

If you wish to edit and never solely show the VM config use this.

host # vm configure freebsd13

FreeBSD

FreeBSD could be boot in two methods. One is with bhyveload which can be translated to legacy BIOS boot. You can too in fact boot FreeBSD un UEFI mode.

host # cat /vm/.templates/freebsd.conf
loader="bhyveload"
cpu=1
reminiscence=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"

The above will use bhyveload and it principally works … however typically if you wish to set up lots newer model beneath Bhyve the loader might not have all of the wanted options. I used to be hit by this drawback just lately the place I used FreeBSD 13.2-RELEASE for the FreeBSD host system and wished to strive 14.0-ALPHA1 model.

I described the small print of this drawback right here – FreeBSD Bug 273099 – in a BUG report.

That is how such error appears to be like like:

| FreeBSD/amd64 Person boot lua, Revision 1.2
| ZFS: unsupported function: com.klarasystems:vdev_zaps_v2
| ERROR: can not open /boot/lua/loader.lua: no such file or listing.
| 
| Kind '?' for an inventory of instructions, 'assist' for extra detailed assist.
| OK 

To beat that you will want newest (extra updated then 14.0-ALPHA1 model) FreeBSD sources and under instructions.

host # pkg set up gitup

host # cp /usr/native/and so forth/gitup.conf.pattern /usr/native/and so forth/gitup.conf

host # gitup present

host # cd /usr/src/stand

host # make

host # discover /usr/obj -type f -name userboot_lua.so
/usr/obj/usr/src/amd64.amd64/stand/userboot/userboot_lua/userboot_lua.so

host # cp /usr/obj/usr/src/amd64.amd64/stand/userboot/userboot_lua/userboot_lua.so /vm/userboot_lua.so

Now – we have to add bhyveload_loader="/vm/userboot_lua.so" choice to out FreeBSD 14.0-ALPHA1 machine config.

host # cat /vm/freebsd14/freebsd14.conf
loader="bhyveload"
bhyveload_loader="/vm/userboot_lua.so"
cpu=1
reminiscence=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"
uuid="975bca2a-39c4-11ee-b73d-f0def1d6aea1"
network0_mac="58:9c:fc:03:67:47"

Now it’s going to boot correctly.

After all it was very straightforward to beat that utilizing UEFI boot as an alternative.

host # cat /vm/freebsd14uefi/freebsd14uefi.conf
loader="uefi"
cpu=1
reminiscence=256M
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"
uuid="35ca42b7-7f28-43eb-afd9-2488c5ec83cf"
network0_mac="58:9c:fc:0a:16:4b"

Linux

By default for Linux the grub manner is the proposed manner. I don’t use it as at it olny permits console entry – and even many so known as enterprice grade Linux distributions comparable to AlmaLinux or Rocky have graphical installer that wants/needs graphical show … and that’s solely out there in uefi mode.

Possibly for Alpine or Void Linux such method could also be usable … however uefi may also work very effectively – thus I don’t see ANY benefits of utilizing grub manner right here.

I’ll present you the subsequent instance primarily based on AlmaLinux 8.x set up however the identical labored correctly with Ubuntu Mate for instance.

First the default template.

host # cat /vm/.templates/linux.conf
loader="uefi"
cpu=2
reminiscence=4G
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"
xhci_mouse="sure"
graphics="sure"

The above added xhci_mouse="sure" makes use of extra exact xhci(4) USB 3.x mouse driver and graphics="sure" forces the publicity of VNC connection.

With such template the set up appears to be like like that.

host # cp AlmaLinux-8.8-x86_64-minimal.iso /vm/.iso/

host # vm create -t linux almalinux8

host # vm set up almalinux8 AlmaLinux-8.8-x86_64-minimal.iso
Beginning almalinux8
  * discovered visitor in /vm/almalinux8
  * booting...

host # vm checklist
NAME           DATASTORE  LOADER     CPU  MEMORY  VNC           AUTO  STATE
almalinux8     default    uefi       2    4G      0.0.0.0:5900  No    Working (11819)

host % vncviewer -SendClipboard -AcceptClipboard -LowColorLevel -QualityLevel 6 :5900 &

The final vncviewer(1) command is executed as common consumer. It comes from web/tigervnc-viewer bundle.

If you’ll be connecting to some exterior server then use IP deal with within the command.

host % vncviewer -SendClipboard -AcceptClipboard -LowColorLevel -QualityLevel 6 10.0.0.66::5900 &

After the Linux system is put in you could specify the precise VNC port or IP deal with. Additionally the display screen decision or allow/disable ready for the VNC connection.

graphics_port="5900"
graphics_listen="0.0.0.0"
graphics_res="1400x900"
graphics_wait="no"

Home windows 7

Lots of people will criticize me for this one – as Home windows 7 isn’t an formally supported model anymore. I don’t care about that after I need to use some localhost software program … or older software program that works higher on older model. To not point out that its one of many final Home windows variations that doesn’t pressure on-line Microsoft account down your throat. It additionally makes use of much less assets and is extra responsive.

First – the template – just like the Linux one.

host # cat /vm/.templates/windows7.conf           
loader="uefi"
graphics="sure"
cpu=2
reminiscence=2G
ahci_device_limit="8"
network0_type="e1000"
network0_switch="public"
disk0_type="ahci-hd"
disk0_name="disk0.img"
disk0_opts="sectorsize=512"
utctime="no"
bhyve_options="-s 8,hda,play=/dev/dsp,rec=/dev/dsp"

In case you set the xhci_mouse="sure" choice with Home windows 7 – you’ll find yourself with no working mouse in VNC connection and you’ll have to make all of the set up and configuration by keyboard solely.

One might take into consideration including xhci_mouse="sure" after set up when you’ll have already got working RDP connection – however that might additionally reqiure extra drivers. In concept – the system VEN_8086&DEV_1E31 title is acknowledged as Intel USB 3.0 eXtensible Host Controller … however for some cause anytime I wished to put in it – the Home windows 7 system crashed and immediately rebooted.

The opposite much more imporant factor is having the disk0_opts="sectorsize=512" choice. With out it the Home windows 7 instaler will fail with the next error.

win-7-install-error-NO-512-BLOCKS

The final choice bhyve_options="-s 8,hda,play=/dev/dsp,rec=/dev/dsp" allows audio.

The set up process can also be just like Linux.

host # cp win_7_amd64_sp1_en.iso /vm/.iso/

host # vm iso
DATASTORE           FILENAME
default             win_7_amd64_sp1_en.iso

host # vm create -t windows7 -s 40G windows7

host # vm set up windows7 win_7_amd64_sp1_en.iso
Beginning windows7
  * discovered visitor in /vm/windows7
  * booting...

host # vm checklist
NAME           DATASTORE  LOADER     CPU  MEMORY  VNC           AUTO  STATE
windows7       default    uefi       2    2G      0.0.0.0:5900  No    Working (11819)

host % vncviewer -SendClipboard -AcceptClipboard -LowColorLevel -QualityLevel 6 :5900 &

After the set up we must always allow RDP connections for extra options. Rememeber to pick any model choice.

win-7-computer-properties-advanced-remote

You’ll be able to add a number of CD-ROM drives with following choices within the configure argument.

See Also

disk1_type="ahci-cd"
disk1_dev="customized"
disk1_name="/vm/.iso/virtio-drivers.iso"

It might be simpler for RDP connections to have static IP as an alternative of a DHCP one.

win-7-network-adapter-IPv4-static

Now as now we have the static 10.1.1.7 IP deal with we will use RDP reference to rdesktop(1) command.

host % rdesktop -u buser -p bpass -P -N -z -g 1800x1000 -a 24 -r sound:native -r disk:HOME=/residence/vermaden 10.1.1.7
Autoselecting keyboard map 'en-us' from locale

ATTENTION! The server makes use of and invalid safety certificates which can't be trusted for
the next recognized causes(s);

 1. Certificates issuer isn't trusted by this technique.

     Issuer: CN=vbox


Assessment the next certificates information earlier than you belief it to be added as an exception.
If you don't belief the certificates the connection atempt shall be aborted:

    Topic: CN=vbox
     Issuer: CN=vbox
 Legitimate From: Mon Aug 14 00:58:25 2023
         To: Mon Feb 12 23:58:25 2024

  Certificates fingerprints:

       sha1: 4ad853c40a8aa0560af315b691038202506e07ce
     sha256: 44ec8f7650486aef6261aea42da99caba4e84d7bc58341c0ca1bb8e28b81d222


Do you belief this certificates (sure/no)? sure
Connection established utilizing SSL.

There are a number of helpful choices right here.

The -u buser and -p bpass will deal with credentials.

The -P choice allows caching of bitmaps to disk (persistent bitmap caching). This improves efficiency (particularly on low bandwidth connections) and reduces community site visitors.

The -N choice allows numlock synchronization between the X11 server and distant RDP session.

The -z allows compression of the RDP datastream.

The -g 1800x1000 and -a 24 specifies decision and shade depth fee.

The -r disk:HOME=/residence/vermaden allows clear sharing of your property listing and extra share is proven in My Pc within the Home windows 7 machine – very useful for sharing recordsdata between the host and visitor VM as chown under.

win-7-sharing

The final one choice -r sound:native specifies that the audio shall be realized on the visitor VM – it will solely work if you happen to added the bhyve_options="-s 8,hda,play=/dev/dsp,rec=/dev/dsp" to the Home windows 7 Bhyve config. Alternatively with out that hda(4) emulation you should utilize -r sound:distant choice – this may use RDP protocol to switch audio occasions from the visitor machine to your host machine after which audio shall be performed then regionally in your host machine.

Home windows 10

Lastly a supported model.

Template is just like the Home windows 7 one.

host # cat /vm/.templates/windows10.conf
loader="uefi"
graphics="sure"
xhci_mouse="sure"
cpu=2
reminiscence=2G
ahci_device_limit="8"
network0_type="e1000"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"
utctime="no"
bhyve_options="-s 8,hda,play=/dev/dsp,rec=/dev/dsp"

The Home windows 10 helps the xhci_mouse="sure" so we allow and maintain it on a regular basis.

The Home windows 10 doesn’t want the disk0_opts="sectorsize=512" choice.

As Home windows 10 is newer – the nvme can (and will) be used for efficiency causes.

The final choice bhyve_options="-s 8,hda,play=/dev/dsp,rec=/dev/dsp" allows audio.

The set up process can also be just like Home windows 7.

host # cp win_10_amd64_en_LTSC.iso /vm/.iso/

host # vm iso
DATASTORE           FILENAME
default             win_10_amd64_en_LTSC.iso

host # vm create -t windows10 -s 40G windows10

host # vm set up windows10 win_10_amd64_en_LTSC.iso
Beginning windows10
  * discovered visitor in /vm/windows10
  * booting...

host # vm checklist
NAME           DATASTORE  LOADER     CPU  MEMORY  VNC           AUTO  STATE
windows10      default    uefi       2    2G      0.0.0.0:5900  No    Working (11819)

host % vncviewer -SendClipboard -AcceptClipboard -LowColorLevel -QualityLevel 6 :5900 &

After the set up we must always allow RDP connections for extra options. Bear in mind to pick any model choice.

win-10-advanced-settings-remote

You’ll be able to add a number of CD-ROM drives with following choices within the configure argument.

disk1_type="ahci-cd"
disk1_dev="customized"
disk1_name="/vm/.iso/virtio-drivers.iso"

It might be simpler for RDP connections to have static IP as an alternative of a DHCP one.

win-10-network-settings-adapter-properties-IPv4-static

Now as now we have the static 10.1.1.8 IP deal with we will use RDP reference to rdesktop(1) command.

host % rdesktop -u buser -p bpass -P -N -z -g 1600x900 -a 24 -r sound:native -r disk:HOME=/residence/vermaden 10.1.1.8
Autoselecting keyboard map 'en-us' from locale

ATTENTION! The server makes use of and invalid safety certificates which can't be trusted for
the next recognized causes(s);

 1. Certificates issuer isn't trusted by this technique.

     Issuer: CN=DESKTOP-HKJ3H6T


Assessment the next certificates information earlier than you belief it to be added as an exception.
If you don't belief the certificates the connection atempt shall be aborted:

    Topic: CN=DESKTOP-HKJ3H6T
     Issuer: CN=DESKTOP-HKJ3H6T
 Legitimate From: Mon Aug 14 10:33:41 2023
         To: Tue Feb 13 09:33:41 2024

  Certificates fingerprints:

       sha1: 967d5cdb164e53f7eb4c5c17b0343f2f279fb709
     sha256: c08b732122a39c44d91fac2a9093724da12d2f3e6ea51613245d13cf762f4cd2


Do you belief this certificates (sure/no)? sure

Choices are the identical as with Home windows 7 and they’re described within the Home windows 7 part.

Pressure Home windows 10 Offline Account

To pressure creation of native account as an alternative of pressured on-line account it’s good to boot the Home windows 10 with out community.

Do the next steps to do this.

host # sure | vm poweroff windows10

host # vm configure windows10
- network0_type="e1000"
- network0_switch="public"

host # vm begin windows10

Now create the offline account.

After creating it poweroff the Home windows 10 VM.

host # vm configure windows10
+ network0_type="e1000"
+ network0_switch="public"

host # vm begin windows10

Now you’ve got native account on Home windows 10 system.

Home windows 10 Bloat Removers

You might think about using on of the identified Home windows 10 bloat removers out there right here:

Home windows 11

The setup/set up of Home windows 11 is identical as Home windows 10.

Coping with Locked VMs

Lets assume that our host system crashed.

The vm-bhyve will left run.lock recordsdata within the machines dirs.

host # ls -l /vm/freebsd14uefi
complete 1389223K
-rw-r--r-- 1 root wheel          32 2023-08-16 23:36 console
-rw------- 1 root wheel 21474836480 2023-08-16 23:46 disk0.img
-rw-r--r-- 1 root wheel         200 2023-08-16 23:35 freebsd14uefi.conf
-rw-r--r-- 1 root wheel          11 2023-08-16 23:36 run.lock
-rw-r--r-- 1 root wheel        5583 2023-08-16 23:36 vm-bhyve.log

host # vm checklist
NAME           DATASTORE  LOADER     CPU  MEMORY  VNC  AUTO     STATE
almalinux8     default    uefi       2    2G      -    No       Stopped
freebsd13      default    bhyveload  1    256M    -    Sure [1]  Working (19258)
freebsd13alt   default    bhyveload  1    256M    -    No       Stopped
freebsd14      default    bhyveload  1    256M    -    No       Stopped
freebsd14uefi  default    uefi       2    8G      -    No       Locked (w520.native)
windows10ltsc  default    uefi       2    2G      -    No       Stopped
windows7       default    uefi       2    2G      -    No       Stopped

host # rm /vm/freebsd14uefi/run.lock

host # vm checklist
NAME           DATASTORE  LOADER     CPU  MEMORY  VNC  AUTO     STATE
almalinux8     default    uefi       2    2G      -    No       Stopped
freebsd13      default    bhyveload  1    256M    -    Sure [1]  Working (19258)
freebsd13alt   default    bhyveload  1    256M    -    No       Stopped
freebsd14      default    bhyveload  1    256M    -    No       Stopped
freebsd14uefi  default    uefi       2    8G      -    No       Stopped
windows10ltsc  default    uefi       2    2G      -    No       Stopped
windows7       default    uefi       2    2G      -    No       Stopped

Now you could need to begin the locked machine correctly.

Disk Resize

By default vm-bhyve will create disks with 20 GB in measurement.

To resize the Bhyve digital machine disk we might use truncate(1) command.

host # vm cease freebsd13

host # cd /vm/freebsd13

host # truncate -s 40G disk0.img

host # vm begin freebsd13

In case you are undecided about that – you could work on a replica as an alternative.

host # vm cease freebsd13

host # truncate -s 40G disk0.img.NEW

host # dd bs=1m if=disk0.img of=disk0.img.NEW conv=notrunc standing=progress
  20865613824 bytes (21 GB, 19 GiB) transferred 43.002s, 485 MB/s
20480+0 data in
20480+0 data out
21474836480 bytes transferred in 43.454036 secs (494196586 bytes/sec)

host # mv disk0.img disk0.img.BACKUP

host # mv disk0.img.NEW disk0.img

host # vm begin freebsd13

Now we have to resize the filesystem contained in the VM.

freebsd13 # lsblk
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
nvd0             0:90   40G GPT                                               - -
  nvd0p1         0:91  512K freebsd-boot                           gpt/gptboot0 -
           -:-   492K -                                                 - -
  nvd0p2         0:92  2.0G freebsd-swap                              gpt/swap0 SWAP
  nvd0p3         0:93   18G freebsd-zfs                                gpt/zfs0 
           -:-   1.0M -                                                 - -

freebsd13 # geom disk checklist
Geom title: nvd0
Suppliers:
1. Title: nvd0
   Mediasize: 42949672960 (40G)
   Sectorsize: 512
   Mode: r2w2e3
   descr: bhyve-NVMe
   lunid: 589cfc2081410001
   ident: NVME-4-0
   rotationrate: 0
   fwsectors: 0
   fwheads: 0

freebsd13 # gpart present
=>      40  41942960  nvd0  GPT  (40G) [CORRUPT]
        40      1024     1  freebsd-boot  (512K)
      1064       984        - free -  (492K)
      2048   4194304     2  freebsd-swap  (2.0G)
   4196352  37744640     3  freebsd-zfs  (18G)
  41940992      2008        - free -  (1.0M)

freebsd13 # gpart recuperate nvd0
nvd0 recovered

freebsd13 # gpart present
=>      40  83886000  nvd0  GPT  (40G)
        40      1024     1  freebsd-boot  (512K)
      1064       984        - free -  (492K)
      2048   4194304     2  freebsd-swap  (2.0G)
   4196352  37744640     3  freebsd-zfs  (18G)
  41940992  41945048        - free -  (20G)

freebsd13 # gpart resize -i 3 -a 1m nvd0
nvd0p3 resized

freebsd13 # gpart present
=>      40  83886000  nvd0  GPT  (40G)
        40      1024     1  freebsd-boot  (512K)
      1064       984        - free -  (492K)
      2048   4194304     2  freebsd-swap  (2.0G)
   4196352  79687680     3  freebsd-zfs  (38G)
  83884032      2008        - free -  (1.0M)

freebsd13 # zpool standing
  pool: zroot
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          nvd0p3    ONLINE       0     0     0

freebsd13 # zpool checklist
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
zroot  17.5G  17.0G   544M        -         -    87%    96%  1.00x    ONLINE  -

freebsd13 # zpool set autoexpand=on zroot

freebsd13 # zpool on-line -e zroot nvd0p3

freebsd13 # zpool checklist
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
zroot  37.5G  17.0G  20.5G        -         -    41%    45%  1.00x    ONLINE  -

I hope I used to be capable of present all wanted data.

Let me know in feedback if I missed one thing.

EOF

Source Link

What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top