How to Configure Virtual Storage as SSD in KVM/QEMU for Optimal Guest OS Performance
5 views
When migrating from VirtualBox to KVM (QEMU/libvirt), many users notice the missing "Solid-state Drive" checkbox that was present in VirtualBox's storage configuration. This setting plays a crucial role in guest OS behavior, particularly for Windows VMs where it automatically disables disk defragmentation for SSD devices.
Unlike VirtualBox's explicit GUI option, KVM/QEMU handles storage media type identification through different mechanisms. The virtualization stack provides several ways to achieve similar functionality:
# Sample libvirt XML configuration for SSD emulation
To properly emulate SSD characteristics in KVM, focus on these critical parameters:
discard='unmap': Enables TRIM support (crucial for SSD performance)
cache='none': Bypasses host caching for more accurate SSD behavior
io='native': Uses optimal I/O paths for virtual SSDs
Consider using raw format instead of qcow2 for better performance
Align partitions properly (usually 1MB alignment for modern SSDs)
Disable swap partitions or use swap files with proper SSD settings
When migrating from VirtualBox to KVM/QEMU, one notable difference is how storage devices are presented to guest systems. While VirtualBox provides a straightforward checkbox to mark virtual disks as SSDs, KVM requires more explicit configuration.
The most reliable way to make a guest OS recognize your virtual disk as SSD is through the libvirt domain XML configuration: