Virtualization¶
17 cards — 🟢 3 easy | 🟡 4 medium | 🔴 3 hard
🟢 Easy (3)¶
1. What is the difference between a Type 1 and Type 2 hypervisor?
Show answer
Type 1 (bare-metal) runs directly on hardware with no host OS — examples: ESXi, KVM, Xen, Hyper-V. Type 2 (hosted) runs on top of a host OS — examples: VirtualBox, VMware Workstation. Type 1 has lower overhead and is used in datacenters and cloud. Type 2 is used for development and testing.Remember: "Hypervisor = VM manager." Type 1 (bare metal): ESXi, Hyper-V, KVM. Type 2 (hosted): VirtualBox, VMware Workstation.
2. What are the three components of the Linux virtualization stack?
Show answer
KVM (kernel module providing hardware-accelerated CPU and memory virtualization via /dev/kvm), QEMU (userspace hardware emulation for disks, NICs, USB, display), and libvirt (unified API and daemon for managing VMs — virsh, virt-manager, and Terraform all talk to libvirt).Remember: "VM vs Container: VMs virtualize hardware (heavy, isolated), Containers share the kernel (light, fast)."
Gotcha: Containers are NOT VMs — a kernel exploit escapes all containers.
3. Why should you always use VirtIO devices in production VMs?
Show answer
VirtIO is a paravirtualized framework where the guest explicitly cooperates with the hypervisor. Compared to fully emulated devices (e.g., e1000 NIC or IDE disk), VirtIO provides 2-10x better network performance and 2-5x better block storage performance because it avoids the overhead of emulating legacy hardware.🟡 Medium (4)¶
1. What are the essential virsh commands for VM lifecycle management?
Show answer
virsh list --all (list VMs), virsh start/shutdown/destroy/reboot2. Compare raw and qcow2 VM disk formats.
Show answer
raw: no thin provisioning, no snapshots, best I/O performance — use for high-performance workloads. qcow2: supports thin provisioning (disk grows on demand), supports snapshots, good performance — use for general purpose. qcow2 is the default choice; raw is for when maximum I/O performance is critical.3. How do VM snapshots work and why are they not a substitute for backups?
Show answer
Snapshots create a chain of differential disk images capturing a point-in-time state (virsh snapshot-create-as, snapshot-revert, snapshot-delete). They are not backups because the chain degrades performance as it grows, they reside on the same storage as the VM, and they are meant for short-term rollback points (hours, not weeks).4. What are the prerequisites and steps for live migration of a VM?
Show answer
Prerequisites: shared storage (NFS, Ceph, GlusterFS) or use --copy-storage-all, same CPU architecture on both hosts, network connectivity, libvirtd on both hosts. Steps: memory pages iteratively copied to destination, VM briefly paused when dirty page rate converges, remaining state (CPU registers, device state) transferred, VM resumes on destination. Typical downtime: 10-200ms.🔴 Hard (3)¶
1. Why does NUMA-aware VM placement matter and how do you configure it?
Show answer
Modern multi-socket servers have Non-Uniform Memory Access — CPUs have fast local memory and slow remote memory (40-100ns extra latency per access). Pin a VM's vCPUs and memory to the same NUMA node using virsh vcpupin2. How does memory ballooning work in virtualization?
Show answer
The virtio-balloon driver lets the hypervisor reclaim memory from guests dynamically. virsh setmem3. How does VMware ESXi differ from KVM in enterprise environments?
Show answer
ESXi is a proprietary Type 1 hypervisor (free tier available, features require vSphere license). It uses vCenter for multi-host management (equivalent to oVirt for KVM), VMFS or vSAN for storage (vs qcow2/raw), and vMotion for live migration. CLI access via esxcli and vim-cmd.Key difference: ESXi is a managed product with enterprise support; KVM is open-source with community tooling.