305-300 practice question 7 of 15

Which of the following commands boots a QEMU virtual machine using hardware virtualization extensions?

Full set: 121 questions
Answer options
A: qvirt -create -drive file=debian.img -cdrom debian.iso -m 1024 -boot d -driver hvm
B: vm -kvm -drive file=debian.img -cdrom debian.iso -m 1024 -boot d
C: qemu-hw -create -drive file=debian.img -cdrom debian.iso -m 1024 -boot d
D: qemu -accel kvm -drive file-debian.img -cdrom debian.iso -m 1024 -boot d Correct answer
E: qvm start -vmx -drive file=debian.img -cdrom debian.iso -m 1024 -boot d
Correct Answer:
D. qemu -accel kvm -drive file-debian.img -cdrom debian.iso -m 1024 -boot d
Explanation

The command in option D correctly uses the modern QEMU syntax to launch a virtual machine with hardware acceleration. The qemu command (typically a symbolic link to a system-specific binary like qemu-system-x8664) initiates the emulator. The crucial option is -accel kvm, which explicitly instructs QEMU to use the KVM (Kernel-based Virtual Machine) accelerator. KVM is the Linux kernel module that interfaces directly with CPU hardware virtualization extensions (Intel VT-x or AMD-V), providing significantly better performance than pure software emulation. The remaining options correctly specify the virtual hard drive, a CD-ROM image, memory allocation, and the boot device.

Why Incorrect

A. qvirt is not a standard QEMU command, and the -driver hvm syntax is incorrect for specifying the KVM accelerator.
B. The command vm is not a standard QEMU executable. While -kvm was a legacy option, the command itself is invalid.
C. qemu-hw is not a standard QEMU command. Furthermore, -create is an option for the qemu-img utility to create disk images, not for booting a VM.
E. qvm is not a standard QEMU command (it is associated with the Qubes OS toolkit), and -vmx is not a valid QEMU option to enable hardware virtualization.

References

1. QEMU Official Documentation: The user documentation for qemu-system-x8664 specifies the -accel option for selecting an accelerator. It states: -accel accelname[,prop=value][,...] and lists kvm as a valid accelerator name. It also notes that the legacy -enable-kvm option is a shortcut for -machine accel=kvm.

Source: QEMU User Documentation, Section: "Generic options", subsection for -accel. (Accessible via man qemu-system-x8664).

2. Red Hat Enterprise Linux 8 Documentation (Official Vendor Documentation): In the guide for virtualization, the command-line creation of KVM guest virtual machines is detailed. It shows the use of qemu-system-x8664 with the -enable-kvm flag, which is functionally equivalent to -accel kvm for enabling hardware virtualization.

Source: Red Hat Enterprise Linux 8, "Configuring and managing virtualization", Chapter 9. "Creating virtual machines with the command-line interface", Section 9.2. "Creating a KVM guest virtual machine using command-line tools".

3. The Linux Kernel Archives (Official KVM Documentation): The KVM documentation, while focused on the kernel API, consistently refers to QEMU as the userspace component that utilizes the KVM infrastructure. It clarifies that KVM is the technology providing access to the hardware virtualization capabilities.

Source: KVM (Kernel-based Virtual Machine) Project Documentation, available at https://www.linux-kvm.org/page/MainPage. The documentation directs users to the QEMU project for command-line usage.

Scroll to Top