2021-02-13 11:38:38 -08:00
|
|
|
|
#!/usr/local/bin/bash
|
|
|
|
|
|
|
|
|
|
# Copyright (c) 2018-2021, diyIT.org
|
|
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
|
|
|
|
|
# https://diyit.org/license/
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# ./cvm-b.sh under tmux
|
|
|
|
|
|
|
|
|
|
# clean cached state
|
|
|
|
|
bhyvectl --destroy --vm=cvm-b
|
|
|
|
|
|
2022-04-19 13:38:56 -07:00
|
|
|
|
exit
|
|
|
|
|
|
2021-02-13 11:38:38 -08:00
|
|
|
|
while true
|
|
|
|
|
do
|
|
|
|
|
|
2021-04-17 11:05:38 -07:00
|
|
|
|
bhyve -c 8 -m 32G -A -H -P \
|
2021-02-13 11:38:38 -08:00
|
|
|
|
-s 0,hostbridge \
|
|
|
|
|
-s 3,ahci-cd \
|
|
|
|
|
-s 4,virtio-blk,/dev/zvol/ship/raw/cvm-b \
|
|
|
|
|
-s 5,virtio-net,tap96,mac=00:0A:0B:0C:0D:96 \
|
|
|
|
|
-s 6,virtio-blk,/dev/zvol/ship/raw/cvm-b_data \
|
2021-04-01 01:23:14 -07:00
|
|
|
|
-s 7,virtio-net,tap4896,mac=00:0A:0B:0C:7D:96 \
|
2021-02-13 11:38:38 -08:00
|
|
|
|
-s 8,virtio-net,tap1096,mac=00:0A:0B:0C:8D:96 \
|
|
|
|
|
-s 9,virtio-net,tap2096,mac=00:0A:0B:0C:9D:96 \
|
|
|
|
|
-s 29,fbuf,tcp=0.0.0.0:5996,w=1600,h=900 \
|
|
|
|
|
-s 30,xhci,tablet \
|
|
|
|
|
-s 31,lpc -l com1,/dev/nmdm96A \
|
|
|
|
|
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
|
|
|
|
|
cvm-b
|
|
|
|
|
|
|
|
|
|
bhyve_exit=$?
|
|
|
|
|
# bhyve returns the following status codes:
|
|
|
|
|
# 0 - VM has been reset
|
|
|
|
|
# 1 - VM has been powered off
|
|
|
|
|
# 2 - VM has been halted
|
|
|
|
|
# 3 - VM generated a triple fault
|
|
|
|
|
# all other non-zero status codes are errors
|
|
|
|
|
#
|
|
|
|
|
if [ $bhyve_exit = 1 ] || [ $bhyve_exit = 2 ]
|
|
|
|
|
then
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
echo `date` - restarting cvm-b in 5 seconds - press ctrl-c to stop
|
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
exit $?
|
|
|
|
|
|
|
|
|
|
# -s 3,ahci-cd,/mnt/linux/ubuntu-20.04.1-live-server-amd64.iso \
|
|
|
|
|
|
|
|
|
|
# bhyvectl --get-all --vm=cvm-b
|
|
|
|
|
|
|
|
|
|
# cu -l /dev/nmdm96B
|
|
|
|
|
# (This uses cu() so press ~+Ctrl-D to exit)
|
|
|
|
|
|
|
|
|
|
#on base system:
|
|
|
|
|
#zfs create -V 32G -o refreservation=none ship/raw/cvm-b - docker partition
|
|
|
|
|
#zfs create -V 128G -o refreservation=none ship/raw/cvm-b_data - root partition
|