Which QEMU-KVM feature allows you to save the state of a VM to a file and resume it later?
Saves the VM state to a file.
Why this answer
The 'virsh save' command creates a state file, which can be restored with 'virsh restore'.
194 questions total · 3pages · All types, answers revealed
Which QEMU-KVM feature allows you to save the state of a VM to a file and resume it later?
Saves the VM state to a file.
Why this answer
The 'virsh save' command creates a state file, which can be restored with 'virsh restore'.
You need to attach a new block device to a running VM. What virsh command achieves this?
Correct syntax for attaching a disk.
Why this answer
virsh attach-disk is the correct command to hot-plug a disk.
You need to inspect the configuration of an LXC container named 'web'. Which command should you use?
Displays status and configuration info for 'web'.
Why this answer
'lxc-info -n web' displays information about the specified container.
In the context of virtualization, what does 'ballooning' refer to?
This is the definition of memory ballooning.
Why this answer
Memory ballooning allows the hypervisor to reclaim unused RAM from a guest VM and reallocate it to other VMs.
You need to convert a raw disk image to QCOW2 format to enable snapshotting. Which command is correct?
Correct format and syntax for conversion.
Why this answer
qemu-img convert -f raw -O qcow2 source.img target.qcow2 is the standard syntax.
Which TWO of the following commands can be used to manage virtual networks in libvirt?
Defines a network from XML.
Why this answer
virsh net-list and virsh net-define are standard commands.
Which THREE items are typically included in an OpenVZ configuration file?
UBC define resource constraints for the container.
Why this answer
OpenVZ configs contain networking definitions, resource limits (UBC), and OS template references.
Which TWO of the following are valid ways to trigger provisioning in Vagrant?
Triggers provisioning on an active VM.
Why this answer
'vagrant up --provision' runs provisioners during startup, and 'vagrant provision' runs them on a running machine.
Which command is used to list all defined virtual networks in Libvirt?
This is the correct command to list networks.
Why this answer
virsh net-list --all displays both active and inactive virtual networks.
You need to enable hugepages for a VM in libvirt to improve memory performance. What XML entry do you add?
Correct XML for hugepages.
Why this answer
The <memoryBacking> element with <hugepages/> is required.
You are troubleshooting a problem where an LXC container cannot access its own /dev/null. What is a common cause in a non-root container?
Containers often need to be able to create nodes if they aren't provided by default.
Why this answer
Lack of device node creation in the container's /dev directory or improper cgroup permissions often causes this.
What is the default behavior of Vagrant when a box is not found locally on the host machine?
Vagrant tries to download it automatically.
Why this answer
Vagrant automatically attempts to download the specified box from HashiCorp's Vagrant Cloud (or configured registry).
Which tool is commonly used alongside Packer to validate the configuration file for syntax errors before attempting a build?
This is the standard validation command.
Why this answer
'packer validate' is the built-in command to check for syntax and configuration errors in Packer files.
You are configuring an LXC container and need to grant it access to a specific host character device without running the container in privileged mode. Which configuration option in the container's config file should you use?
This allows the container to access the specified device node.
Why this answer
The lxc.cgroup2.devices.allow directive is the standard way to whitelist specific hardware devices for a container in cgroup2-based environments.
In cloud-init, which syntax is required at the very beginning of the configuration file to ensure it is recognized as a cloud-config script?
This is the required header.
Why this answer
Cloud-init scripts must start with the '#cloud-config' directive to be correctly parsed as YAML configuration.
You are using a BSD Jail and want to limit the filesystem access of the jail to a specific directory tree. Which utility or configuration mechanism is primarily used to achieve this?
This defines the directory tree the jail is restricted to.
Why this answer
The 'path' configuration parameter in the jail.conf file defines the root directory of the jail.
In a Docker swarm, which mode of service publishing allows incoming traffic to be load-balanced across all healthy container replicas?
This enables the routing mesh for load balancing.
Why this answer
The 'ingress' network mode in Swarm allows external traffic to hit any node and be routed to a container via the routing mesh.
Which command lists all Docker images currently on the host?
This lists local images.
Why this answer
'docker images' or 'docker image ls' lists images.
Which TWO of the following are valid network modes for a libvirt virtual network?
Standard network mode.
Why this answer
NAT and bridge are standard libvirt network modes.
When cleaning up Docker resources, which command will remove all stopped containers, unused networks, and dangling images in one step?
This command cleans up the entire environment of unused resources.
Why this answer
docker system prune removes all unused data, which is the most efficient cleanup method.
When using Vagrant with multiple machines in a single Vagrantfile, how do you define individual configurations?
This allows naming and configuring separate machines.
Why this answer
You use the 'config.vm.define' block to distinguish between multiple machines within one configuration file.
You are using an overlay network in Docker Swarm. What is the standard protocol used for the control plane and data plane communication between nodes?
This is the encapsulation protocol for Docker overlay.
Why this answer
VXLAN is the standard encapsulation protocol used by Docker overlay networks.
What does the term 'KVM' stand for?
Official name for KVM.
Why this answer
Kernel-based Virtual Machine.
Which THREE of the following are required for a successful live migration between two KVM hosts using libvirt?
Essential for keeping the disk accessible.
Why this answer
Shared storage, SSH access, and matching CPU models are critical requirements for a smooth live migration.
Which utility is best for creating a new libvirt storage pool?
Command for creating pool XML.
Why this answer
virsh pool-define-as is the command to create a pool definition.
You need to limit the amount of CPU shares a Docker container can utilize. Which flag should be used?
This allows setting a relative weight for CPU access.
Why this answer
The --cpu-shares flag sets the relative CPU weight of a container.
Which Docker command is used to display the resource usage (CPU, memory) of running containers?
This displays the live resource consumption.
Why this answer
'docker stats' provides a real-time stream of container resource usage statistics.
Which cloud-init module is responsible for setting the hostname of the instance during the initial boot process?
This is the correct module.
Why this answer
The 'hostname' module in cloud-init is designed to update the system hostname based on the provided configuration.
When configuring a Docker volume that needs to be shared between multiple containers, which storage driver storage path is recommended to ensure persistent data availability if the host reboots?
Bind mounts provide persistent access to host filesystems.
Why this answer
Using a named volume or a bind mount to a host directory ensures persistence beyond the container lifecycle.
Which THREE configuration items can be managed by LXC cgroups?
Controls CPU priority.
Why this answer
Cgroups manage memory, CPU, and device access.
Which TWO of the following are valid ways to manage storage pools using virsh?
Creates and starts a pool immediately.
Why this answer
The 'virsh pool-create-as' and 'virsh pool-define-as' commands are the standard ways to manage pools.
What is the default location for libvirt domain configuration XML files?
Directory containing domain XMLs.
Why this answer
/etc/libvirt/qemu/ contains the XML definitions for KVM/QEMU domains.
Which TWO components are defined in a Packer 'build' block?
Defines the builder(s) to use.
Why this answer
A build block contains the 'sources' (builders) and 'provisioners' to be executed on those sources.
You are optimizing a Dockerfile to reduce image size. Which THREE of the following practices are recommended?
Cleaning the package cache reduces image size significantly.
Why this answer
Multi-stage builds, minimizing layers, and cleaning up caches are standard practices.
Which file system structure is typically used for QEMU virtual disk images when using LVM?
Path to an LVM logical volume.
Why this answer
LVM logical volumes (LV) can be used directly as backing storage for VM disks.
You are troubleshooting a performance issue and want to pin a VM process to specific physical CPU cores. Which XML element is used?
Correct syntax for CPU pinning.
Why this answer
The <cputune> and <vcpupin> elements are used for CPU pinning.
Which command is used to list all active running domains?
Lists active domains.
Why this answer
virsh list lists active domains by default.
In the context of container orchestration, what is the role of a 'sidecar' container?
Sidecars are commonly used for logging, proxies, or configuration synchronization.
Why this answer
A sidecar container runs alongside the main application container within the same pod to extend or enhance its functionality.
When using Packer with the QEMU builder, what does the 'format' option in the 'qemu' builder define?
This sets the resulting disk image format.
Why this answer
The 'format' parameter specifies the image format to be produced, such as 'qcow2' or 'raw'.
Which THREE of the following are valid Libvirt storage pool types?
iSCSI targets are supported as storage backends.
Why this answer
Libvirt supports various backends for storage including directories, LVM volume groups, and iSCSI targets.
The XML file defines the network and triggers the iptables rule generation.
Why this answer
Libvirt manages iptables rules dynamically, but the configuration is stored in the libvirt network XML files in /etc/libvirt/qemu/networks/ and the resulting rules appear in the NAT table.
You are debugging a Docker network issue where containers on different hosts cannot communicate. Which network driver is specifically designed to support multi-host overlay networking?
The overlay driver enables multi-host container connectivity.
Why this answer
The 'overlay' driver in Docker creates a distributed network among multiple Docker daemon hosts.
You want to optimize disk I/O performance for a KVM guest. Which bus type should you configure in the libvirt domain XML for the virtual disk?
virtio provides optimal I/O performance via paravirtualization.
Why this answer
virtio is the paravirtualized driver set that provides the highest performance for KVM guests.
Which command-line tool is primarily used to inspect the metadata and configuration of a running Docker container?
This command returns the configuration and state of the object.
Why this answer
docker inspect provides detailed information on containers and images in JSON format.
When migrating a Libvirt domain using 'virsh migrate --live', which option must be specified to ensure the guest's memory state is copied over the network?
This flag forces the migration of non-shared disk images.
Why this answer
The --live option manages the memory transfer, but the --copy-storage-all or --block-incremental option is required if the disks are not on shared storage.
In a Xen environment, which command would you use to change the number of VCPUs allocated to a running domain 'dom1' to 4?
Correct command syntax to change active VCPUs.
Why this answer
xl vcpu-set is the standard command in modern Xen (xl toolstack) to adjust vCPUs.
Which THREE of the following are components of the Docker architecture?
The core engine managing objects.
Why this answer
Docker client, daemon, and registry are the three core components.
You need to migrate a running QEMU VM to a remote host using live migration. Which command-line argument for QEMU-KVM initiates a migration to a target host at 192.168.1.50 on port 4444?
Correct syntax for initiating migration via CLI.
Why this answer
The -migrate command or the migrate QMP command is used, but for the CLI argument, the migration URI must be defined.
You need to create a snapshot of a QCOW2 disk image without stopping the virtual machine. Which qemu-img sub-command should be used?
virsh is the correct tool for live snapshots of libvirt domains.
Why this answer
qemu-img snapshot -c creates a snapshot, but it should only be done on offline images. For live snapshots, virsh snapshot-create is required.
You are using QEMU to emulate an ARM architecture on an x86 host. Which binary would you typically use to execute this?
Correct binary for ARM system emulation.
Why this answer
qemu-system-arm is the specific binary for ARM system emulation.
Which command allows you to enter an existing running container and execute a new command inside it?
This starts a new process in the target container.
Why this answer
'docker exec' is the standard command to run a new process in a running container.
Which THREE of the following are legitimate security concerns when managing a virtualization host?
Can expose guest screen data.
Why this answer
Insecure VNC access, unauthorized host access, and guest-to-host escapes are all major concerns.
Which option for 'qemu-img create' allows you to create a preallocated image?
Specifies full preallocation.
Why this answer
-o preallocation=full creates a fully preallocated file.
Which TWO pieces of information does Packer require to build an image for an existing cloud environment?
Required for authentication.
Why this answer
Packer needs credentials (like API keys) and region/availability zone information to interact with cloud APIs.
This is the correct key under the user definition.
Why this answer
The 'ssh_authorized_keys' directive within the user object specifies which public keys should be injected into the ~/.ssh/authorized_keys file for that user.
Which TWO types of namespaces are commonly used to achieve container isolation in Linux?
Network namespaces isolate the network stack.
Why this answer
Network and PID namespaces are fundamental for containerization.
Which THREE of the following are necessary to enable QEMU guest agent integration?
Guest component.
Why this answer
Installing the guest agent, adding the channel to the XML, and restarting the VM are the required steps.
What is a 'snapshot' in virtualization?
Describes a snapshot.
Why this answer
A snapshot captures the state of a VM's disk (and optionally memory) at a point in time.
You are building a multi-stage Dockerfile and want to copy a binary from the 'builder' stage to the final stage. Which syntax is correct?
This correctly copies the file from the named builder stage.
Why this answer
'COPY --from=stage_name source destination' is the syntax for multi-stage copying.
You are migrating a legacy application to an LXC container and need to ensure the container has access to the host's /dev/sda block device. Which configuration key must be added to the container's configuration file?
This allows the container to access block device 8:0, which corresponds to /dev/sda.
Why this answer
To allow a container to access host devices, the lxc.cgroup.devices.allow and lxc.mount.entry must be configured properly in the container config.
Which component is responsible for the actual hardware-assisted virtualization in KVM?
The kernel module enables hardware virtualization.
Why this answer
The Linux kernel, specifically the KVM module, provides the interface to the hardware.
You are using Packer to automate a build. You notice the build fails because the 'communicator' cannot connect. Which type of communicator is most suitable for a KVM-based build where SSH is not yet configured?
This is used when external orchestration is not required.
Why this answer
The 'none' communicator is used when the builder handles the image creation without needing remote access, or 'ssh' if the guest OS supports it. However, if the build relies on console output/keystrokes, the 'none' communicator is often used alongside the boot command.
Which THREE of the following are valid storage driver options for Docker on Linux?
The recommended storage driver for most Linux distributions.
Why this answer
Docker supports multiple storage drivers including overlay2, btrfs, and zfs, depending on the underlying filesystem.
Which THREE of the following are valid elements inside the <interface type='bridge'> block?
Defines the bridge.
Why this answer
<source>, <mac>, and <model> are valid sub-elements for a bridged interface.
Which command-line option is used to run a Docker container in the background (detached mode)?
The -d flag enables detached mode.
Why this answer
The -d flag specifies that the container should run in the background.
You are managing an LXC container and need to create a snapshot of the container's root file system. Which command achieves this?
This creates a snapshot for the specified container.
Why this answer
The lxc-snapshot tool is the standard method for managing LXC container snapshots.
In an OpenVZ environment, you need to limit the number of processes a container can create. Which parameter in the container configuration file should be modified?
This specifically limits the number of processes.
Why this answer
The 'nproc' (or numproc) parameter in the OpenVZ configuration limits the total number of processes a container is allowed to hold.
Which of these is a valid virtualization storage pool type supported by libvirt?
Directory-based storage pool.
Why this answer
'dir' is a common storage pool type that uses a directory in the host filesystem.
In systemd-nspawn, how do you specify a different root directory for the container?
Specifies the root directory.
Why this answer
The -D or --directory flag specifies the root path.
What is the primary difference between a container image and a container instance?
Images are immutable blueprints; containers are the operational runtime.
Why this answer
A container image is a read-only template, whereas a container instance is a writable, running version of that image.
Which THREE commands are used to manage the lifecycle of an LXC container?
Starts the container.
Why this answer
lxc-start, lxc-stop, and lxc-destroy are standard commands for managing container states.
What is the primary function of the ENTRYPOINT instruction in a Dockerfile?
ENTRYPOINT is designed to make the container behave like an executable.
Why this answer
ENTRYPOINT sets the main command that will execute when the container starts.
Which THREE of the following are necessary components for a successful KVM virtualization environment on Linux?
The kernel module provides the interface to the hardware virtualization features.
Why this answer
KVM requires hardware virtualization support, the kernel module, and the QEMU userspace interface.
Which TWO items are typically included in a Docker context?
Source code and artifacts to be copied into the image.
Why this answer
The Docker context includes the Dockerfile and the build directory contents.
How do you view the logs of a running container?
This retrieves the container's stdout/stderr.
Why this answer
'docker logs' is the command to retrieve logs.
Practice 305-300 by domain
Target a specific domain to shore up weak areas.
See all domains with question counts →