Creating and Managing VMs
6 minute read.Last Modified 2021-09-08 09:42 EDT
A Virtual Machine (VM) is an environment on a host computer that you can use as if it were a separate, physical computer. Users can use VMs to run multiple operating systems simultaneously on a single computer. Operating systems running inside a VM see emulated virtual hardware rather than the host computer’s physical hardware. VMs provide more isolation than Jails but will also consume more system resources.
TrueNAS assigns a portion of system RAM and a new zvol to each VM. While a VM is running, these resources are not available to the host computer or other VMs.
- An Intel processor with Extended Page Tables (EPT)
- An AMD processor with Rapid Virtualization Indexing (RVI) or Nested Page Tables (NPT)
To verify that an Intel processor has the required features, open the Shell and run
grep VT-x /var/run/dmesg.boot.
If the Shell shows the EPT and UG features, the processor will work with bhyve.
To verify that an AMD processor has the required features, open the Shell and run
grep POPCNT /var/run/dmesg.boot.
If the output shows the POPCNT feature, the processor will work with bhyve.
Note that AMD K10 “Kuma” processors include POPCNT but do not support NRIS, which bhyve requires. AMD stopped making K10 processors in 2012-2013.
Before creating a virtual machine, you need an installer
To create a new VM, go to Virtualization and click Add (or Add Virtual Machines). Configure each category of the VM according to your specifications, starting with the Operating System.
|Guest Operating System||Choose the VM operating system type.|
|Name||Enter an alphanumeric name for the virtual machine.|
|System Clock *||VM system time. Default is Local.|
|Boot Method||Select UEFI for newer operating systems or Legacy BIOS for older operating systems that only support BIOS booting.|
|Shutdown Timeout||The time in seconds the system waits for the VM to cleanly shut down. During system shutdown, the system initiates poweroff for the VM after the shutdown timeout has expired.|
|Start on Boot||Set to start this VM when the system boots.|
|Enable Display||Enable a Display (Virtual Network Computing) remote connection. Requires UEFI booting.|
|Display Type||Select either VNC or SPICE|
|Bind||Display network interface IP address. The primary interface IP address is the default. A different interface IP address can be chosen.|
CPU and Memory
|Virtual CPUs||Number of virtual CPUs to allocate to the virtual machine. The maximum is 16, or fewer if the host CPU limits the maximum. The VM operating system might also have operational or licensing restrictions on the number of CPUs.|
|Cores||Specify the number of cores per virtual CPU socket. The product of vCPUs, cores, and threads must not exceed 16.|
|Threads||Specify the number of threads per core. The product of vCPUs, cores, and threads must not exceed 16.|
|CPU Mode||Choose between Custom, Model, and Passthrough modes.|
|CPU Model||Select a CPU model to emulate.|
|Memory Size||Allocate RAM for the VM. Minimum value is 256 MiB. This field accepts human-readable input (Ex. 50 GiB, 500M, 2 TB). If units are not specified, the value defaults to bytes.|
|Create new disk image||Create a new zvol on an existing dataset to use as a virtual hard drive for the VM.|
|Use existing disk image||Use an existing zvol or file for the VM.|
|Select Disk Type||Select desired disk type (AHCI or VirtIO).|
|Zvol Location||Select a dataset for the new zvol.|
|Size||Allocate space for the new zvol. (Examples: 500 KiB, 500M, 2 TB) MiB. Units smaller than MiB are not allowed.|
|Adapter Type||Intel e82545 (e1000) emulates the same Intel Ethernet card and provides compatibility with most operating systems. VirtIO provides better performance when the operating system installed in the VM supports VirtIO paravirtualized network drivers.|
|Mac Address||Enter the desired address into the field to override the randomized MAC address.|
|Attach NIC||Select the physical interface to associate with the VM.|
|Choose Installation Media Image||Browse to the operating system installer image file.|
|Upload an Installer Image File||Set to display image upload options.|
|Hide from MSR||Enable to hide the GPU from the Microsoft Reserved Partition (MSR)|
|GPU’s||Select a physical GPU on your system to use for the VM.|
- Compare the recommended specifications for your guest operating system with the available host system resources when allocating Virtual CPUs, Cores, Threads, and Memory Size.
- Don’t allocate too much memory to a VM. Activating a VM with all available memory allocated to it can slow the host system or prevent other VMs from starting.
- We recommend using the AHCI Disk Type for Windows VMs.
- The VirtIO network interface requires a guest OS that supports VirtIO paravirtualized network drivers.
After creating the VM, add and remove virtual devices by expanding the VM entry in Virtualization and clicking device_hubDevices.
- The virtual machine attempts to boot from devices according to the Device Order, starting with 1000, then ascending.
- CD-ROM devices allow booting a VM from a CD-ROM image like an installation CD. The CD image must be available in the system storage.
After creating the VM and configuring any devices for it, manage the VM by expanding its entry in Virtualization.
When the VM is active, it will display options for settings_ethernet VNC and keyboard_arrow_right Serial connections.
If the VNC connection screen appears distorted, try adjusting the VNC device resolution.
Using the State toggle or clicking stop Stop follows a standard shut down procedure to cleanly shut down the running VM. Clicking power_settings_new Power Off immediately halts and deactivates the VM, similar to unplugging a computer.
If the VM you created has no Guest OS installed, The VM State toggle and stop Stop button might not function as expected. The State toggle and stop Stop button send an ACPI power down command to the VM operating system, but since no OS is installed, the commands time out. Use the Power Off button instead.