Top 19 Linux Virtualization Interview Questions You Must Prepare 02.Oct.2022

Using the command ‘virsh list –all’ we can list all virtual machines irrespective of their states.

A VM can have different states like

r – Running

b – Blocked

c – crashed

s – Shutdown

p – Paused

Virtualization can be used in different ways  and  can take many different forms.

Some of them are listed below :

  • Server Virtualization
  • Network Virtualization
  • Hardware virtualization
  • Application virtualization
  • Desktop virtualization
  • User virtualization

For  Xen hypervisor  first we have to install Xen kernel and have to boot the machine with Xen kernel where as KVM is kernel based Virtualization , we don’t need any extra kernel for KVM. KVM is a module in Kernel. Xen hypervisor by default does not support full virtualization whereas KVM supports Full virtualization.

Dom0 or Domain0 is the initial domain started by xen hypervisor. It has the special rights like to start new domain and access the hardware directly. Dom0 is responsible for running all of the device drivers for the hardware. 

Virtualization is a technique for creating virtual resources (rather than the actual) such as server, storage device, network  and Operating system. Virtualization is dis-associating the tight bond between software and hardware.

Some of the basic requirements are listed below :

  • The guest image or virtual machine image  must be located on a shared storage and it must be accessible using iSCSI, NFS, GFS2 or Fibre Channel.
  • The shared storage must be mounted on the same path on both the hypervisors / hosts.
  • Both hypervisors / hosts must run the same version of KVM.
  • Both guests or VMs must have the same network configuration & bridging configuration (their IPs must be different)

Xen & KVM are two hypervisor available in linux.

Use xm command :

# xm shutdown [domain-id]

# xm reboot   [domain-id]

# xm start    [domain-id]

Full virtualization & para virtualization both comes under the Hardware virtualization.

Some of the difference between them are listed below :

Full Virtualization : It is a virtualization in which guest machine(virtual machines) is unaware that it is in virtualized environment therefore hardware is virtualized by the host operating system so that the guest can issue commands to what it thinks is actual hardware but really are just simulated hardware devices created by the host

Para Virtualization : It is a virtualization in which guest machine is aware that it is in virtualized environment . If guest machine require resources like memory & cpu , it issues command to guest operating system  instead of directly communication with actual hardware.

‘virsh migrate –live machine_name qemu+ssh://destination_server/system’

Hypervisor is a piece of a software that is being install on the physical machine , which then further creates and run virtual machines.  Virtual machine are known as guest machines and host machine is the hypervisor on which different virtual machines are created.

We can forcefully shutdown the VM using the command ‘virsh destroy machine_name’.This command should only be used in a case where VM is in Hung state because forcefully shut down may cause filesystem corruption.

Type-1 hypervisor is bare metal hypervisor runs on bare metal  of hardware. Hyper-V and ESXI Server are  the examples of type-1 hypervisor. Type-2 hypervisor is hosted by operating system. Examples of type-2 hypervisor are Microsoft Virtual Server & VMware Server.

Use the command ‘virsh dominfo <domain-name / VM Name>’

To find the  KVM version use the command ‘virsh version’

virsh is the interface or command for managing the virtual machines based on KVM & Xen hypervisor. On virsh interface virtual machines are identified by their domain names , so virsh is generally used to list current domains , to create , pause & shutdown domains.

virt-viewer -c qemu:///system <VMName>