|
|
| |
BVM(8) |
FreeBSD System Manager's Manual |
BVM(8) |
bvm —
Bhyve Virtual machines Management tool
bvm |
--create name
[from template-name] |
bvm |
--ls [byname |
byos | bystatus] |
bvm |
--ll [byname |
byip | byos |
bystatus] |
bvm |
--clone name new-name |
bvm |
--rename name
new-name |
bvm |
--setsw Switch
ip/mask |
The bvm is a
bhyve(8)
virtual machine management tool based on FreeBSD that allows you to easily
manage virtual machines.
The virtual machine's network is handled by one or more virtual
switches. Each switch has a simple name, which is stored in the
corresponding configuration file and can be modified by the
bvm create one or more
bridge(4)
devices for each virtual switch and dynamically assign them to the virtual
machine
tap(4)
interface. When the virtual machine is shut down normally, the
bvm will automatically clean up the useless network
devices.
The bvm supports multiple network cards
and multiple hard disks. Each virtual machine can have multiple network
cards or multiple hard disks, and can easily add, delete, and modify network
cards or hard disks.
Once bvm is installed, the first thing you have to do is
set up the virtual machine's storage directory.
Edit the value of vmdir in
/usr/local/etc/bvm/bvm.conf
If you want to automatically boot the specified list of virtual
machines in order while the host is booting, add the following lines to
/etc/rc.conf to enable:
--abinfo
- Show information for all auto-bootstrap virtual machines.
--addisk
name
- Add a hard disk to the virtual machine.
--autoboot
- Start the automatic booting virtual machine in order. Boot option, which
is usually not required in administrator manual maintenance mode.
Sometimes the host is powered on again after shutdown or unexpected
downtime. At this time, the administrator-set virtual machine can be
automatically started by the rc script. The method is to use
bvm --config to modify the
default value of the auto boot menu to yes.
In self-start mode, bvm will refer to
the boot level and delay options of vm. The boot level is the boot
priority. When there are multiple self-starting virtual machines, the
lower the startup priority, the more the virtual machine starts. Back to
front. Boot time (boot time) After starting the current virtual machine,
it can also be said that the number of seconds is tentative before
starting the next virtual machine. The reason for designing these two
parameters is because some services may need to be activated first to
ensure normal business.
For example, the relationship between the database and the web
service, if the data virtual machine library is not prioritized, it may
cause the web service to be abnormal!
The correct way to use this option is to add the startup
script:
--clone
name new-name
- Clone a new virtual machine from an existing virtual machine.
--config
name
- Edit the configuration of the virtual machine. This option needs to be
used in the case of a virtual machine. Options that allow users to
configure independently are: cpus, ram, iso path, boot from, hostbridge,
uefi, auto boot, disk config, and network config.
- cpus
- The number of CPUs (non-cores) used by the current virtual
machine.
- ram
- The size of the memory requested by the current virtual machine, the
unit of which can be M/G, etc.
- iso path
- The directory where the iso disc image is located (is the directory,
non-iso absolute address). When the directory is specified,
bvm will automatically list the iso files
contained in the current directory. The user can select the menu
number.
- boot from
- This is an important option. When the system is first installed,
bvm will automatically adjust this option to
hd0 for system startup. When you need to use iso disc for system
maintenance, you can change this option to cd0.
- uefi
- This option is mostly used by the operating system that installs the
graphical interface. It needs to be used with VNC to get the desktop.
In addition, this option will invalidate the
--login option because
--login is a text console and does not have
graphical interface operating conditions.
- auto boot
- See
--autoboot for details.
- hostbridge
- This is a schema attribute whose attribute value should be hostbridge
when using the Intel system CPU; its attribute value should be
amd_hostbridge when using the AMD series CPU.
- disk config
- The option can add or delete the hard disk of the current virtual
machine. If you only want to add the hard disk, it is recommended to
use
bvm --addisk
shortcut command.
- network config
- This option allows you to configure the networking or networking of
virtual machines.
--create
name [from
template-name]
- Create a new virtual machine.
# bvm --create vm1
# bvm --create vm2 from vm1
--deldisk
name
- Delete the disks in the virtual machine.
--decrypt
name
- Decrypt the virtual machine.
--encrypt
name
- Encrypt the virtual machine.
--help
- Show all options and descriptions.
--login
name
- Login to a running virtual machine from console, the boot loader of this
virtual machine must be grub, and the uefi mode needs to log in using the
VNC client.
--ls
[byname | byos |
bystatus]
- Show a list and status of all virtual machines. By default, the output is
sorted in ascending order by name, or one of the following options is
specified.
- byname
- Output list in ascending order by name.
- byos
- Output list in ascending order by OS.
- bystatus
- Output list in ascending order by virtual machine status.
# bvm --ls byos
NAME GUEST CPU MEMORY DISK STATE
c Debian 1 512M [2]5.5G off
d Debian 1 512M [1]5G off *
abc Debian 1 512M [1]10G on
b FreeBSD 1 1G [1]10G off
bb FreeBSD 1 1G [1]10G off
# bvm --ls
NAME GUEST CPU MEMORY DISK STATE
abc Debian 1 512M [1]10G on
b FreeBSD 1 1G [1]10G off
bb FreeBSD 1 1G [1]10G off
c Debian 1 512M [2]5.5G off
d Debian 1 512M [1]5G off *
The meaning of the list items is as follows:
- NAME
- The name of the virtual machine.
- GUEST
- Virtual machine operating system.
- CPU
- Number of CPUs.
- MEMORY
- Size of memory.
- DISK
- Disk capacity, the number in square brackets represents the number of
disks, and the capacity is the sum of all disk capacities.
- STATE
- The state of the virtual machine, off or on, if the virtual machine is
locked, a yellow symbol '*' is also displayed, if the virtual machine
is encrypted, a red symbol '*' is also displayed.
--ll
[byname | byip |
byos | bystatus]
- Show a list and status of all virtual machines in long format. By default,
the output is sorted in ascending order by name, or one of the following
options is specified.
- byname
- Output list in ascending order by name.
- byip
- Output list in ascending order by IP-addr.
- byos
- Output list in ascending order by OS.
- bystatus
- Output list in ascending order by virtual machine status.
The added list items have the following meanings:
- IP
- The IP address of the virtual machine.
- LOADER
- The boot loader for the virtual machine.
- AUTOSTART
- The state in which the virtual machine is automatically started,
"Yes" is automatically started, and the number next to it is
the startup sequence.
--lock
name
- Locks the specified virtual machine, and can't
--config , --remove ,
--start , and so on. Only simple read operations
can be performed, such as --vminfo ,
--ls , this option also prevents the risk of
virtual machine files being accidentally deleted.
--lockall
- Lock all virtual machines, behaving the same as
--lock .
--os
- Show a list of operating systems supported by
bvm .
--poweroff
name
- Force the virtual machine to power off. When there are some special
reasons that prevent the virtual machine from shutting down properly, you
need to use this option to force the virtual machine to power off.
--reload-nat
- Reload the NAT port redirect. In general, you do not need to use this
option,
bvm will automatically handle port
redirection, this option is manual mode.
--remove
name
- Destroy a virtual machine and it cannot be recovered. Note that the
virtual machine cannot be running when you run this command.
--rename
name new-name
- Rename the virtual machine.
--restart
name
- Restart a virtual machine.
--rollback
name
- Roll back to the snapshot point.
--setnat
nat ip/mask
- Set the IP address and mask of the NAT.
# bvm --setnat nat0 172.16.1.1/24
--setpr
ip
- Port redirection is set dynamically with immediate effect. In general, the
virtual machine must be turned off to set the virtual machine parameters,
but this option can set the port redirection at any time in the virtual
machine on state, and take effect immediately.
# bvm --setpr 10.10.30.10
--showpr
- Show all list of port redirect.
# bvm --showpr
udp 192.168.1.254:53 -> 9953 abc
tcp 10.10.30.10:22 -> 3322 guo
tcp 172.16.1.3:622 -> 2224 fb
tcp 172.16.1.3:80 -> 8888 fb
tcp 172.16.1.3:23 -> 2003 fb
--setsw
switch ip/mask
- Set the ip address and mask of the virtual switch. The same method as
--setnat .
--showdev
- Select a network device and show its relationship to the virtual machine
NIC.
--showdevall
- Show a relationship table for all network devices.
--showdevuse
- Show a relational table of all network devices in use.
--showdhcp
- Show all DHCP clients.
--showsnap
name
- Show snapshots list of the virtual machine.
--showsnapall
- Show snapshots list of the all virtual machines.
--snapshot
name
- Generating snapshots for the virtual machine.
--start
name
- Start a virtual machine.
--stop
name
- Shut down a virtual machine.
--unlock
name
- Unlock a virtual machine.
--unlockall
- Unlock all virtual machines.
--unsetsw
switch
- Delete the IP address of the virtual switch.
--version
- Show the version number of
bvm installed.
--vminfo
name
- Shows the configuration of the virtual machine.
/usr/local/etc/bvm/bvm.conf
This file records the virtual machine's directory and a list of all supported
operating systems.
/usr/local/etc/bvm/nat.conf
This file records the configuration information for all NAT.
nat0=172.16.1.1/24
nat1=10.10.30.1/24
nat2=192.168.1.1/24
/usr/local/etc/bvm/switch.conf
This file records the configuration information of all virtual switches.
The default 0-2 sets the IP address, and 3-7 is not set.
switch0=10.0.1.0/24
switch1=10.0.2.0/24
switch2=10.0.3.0/24
switch3=
switch4=
switch5=
switch6=
switch7=
/usr/local/etc/bvm/dhcp.conf
This file records DHCP configuration information, including lease time,
DNS, IP address pool, etc.
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |