I have been messing around with different ways to start VM's with Bhyve.
My latest works good. I use the stdio console and sysutils/tmux.
/etc/rc.local
To make sure my VM's shutdown correctly I add this to the hypervisor:
/etc/rc.shutdown.local
So I am willing to take any criticisms. Please critique my methods.
Next I want to try and quad screen all 4 tmux sessions into one big main screen.
My latest works good. I use the stdio console and sysutils/tmux.
/etc/rc.local
Code:
#!/bin/sh
bhyveload -m 8G -S -d /vm/freebsd/freebsd1.img freebsd1
sleep 2
bhyveload -m 4G -S -d /vm/freebsd/freebsd2.img freebsd2
sleep 2
bhyveload -m 4G -S -d /vm/freebsd/freebsd3.img freebsd3
sleep 2
bhyveload -m 8G -S -d /vm/freebsd/freebsd4.img freebsd4
sleep 8
/usr/local/bin/tmux new-session -d -s freebsd1 'bhyve -S -m 8G -c 8 -AHP -s 0,hostbridge -s 1,lpc -s 2:0,ahci-hd,/vm/freebsd/freebsd1.img -s 5:0,passthru,132/0/0 -s30,xhci,tablet -l com1,stdio freebsd1'
sleep 2
/usr/local/bin/tmux new-session -d -s freebsd2 'bhyve -S -m 4G -c 4 -AHP -s 0,hostbridge -s 1,lpc -s 2:0,ahci-hd,/vm/freebsd/freebsd2.img -s 5:0,passthru,132/0/1 -s30,xhci,tablet -l com1,stdio freebsd2'
sleep 2
/usr/local/bin/tmux new-session -d -s freebsd3 'bhyve -S -m 4G -c 4 -AHP -s 0,hostbridge -s 1,lpc -s 2:0,ahci-hd,/vm/freebsd/freebsd3.img -s 5:0,passthru,134/0/0 -s30,xhci,tablet -l com1,stdio freebsd3'
sleep 2
/usr/local/bin/tmux new-session -d -s freebsd4 'bhyve -S -m 8G -c 8 -AHP -s 0,hostbridge -s 1,lpc -s 2:0,ahci-hd,/vm/freebsd/freebsd4.img -s 5:0,passthru,134/0/1 -s30,xhci,tablet -l com1,stdio freebsd4'
To make sure my VM's shutdown correctly I add this to the hypervisor:
/etc/rc.shutdown.local
Code:
#!/bin/sh
pkill bhyve
sleep 10
bhyvectl --destroy --vm=freebsd1
bhyvectl --destroy --vm=freebsd2
bhyvectl --destroy --vm=freebsd3
bhyvectl --destroy --vm=freebsd4
tmux kill-server
So I am willing to take any criticisms. Please critique my methods.
Next I want to try and quad screen all 4 tmux sessions into one big main screen.