I needed to check the SMART attributes to get the health status of an SSD today. I’m running Fedora on my laptop, and I know Linux has tools for checking disk SMART attributes and health.
However, I also wanted to explore what KVM can do with passthrough devices for virtual machines, knowing that I’ll need to keep Windows around as a VM while switching to Linux as my daily driver. I tried passing the USB-to-SATA connector device to my Windows VM running on KVM. However, I couldn’t see the info in CrystalDiskInfo, a common tool in Windows that gives a simple summary.
Also, I have the libvirt tools and drivers installed in the Windows VM so that it integrates nicely with KVM.
My question:
Does KVM passthrough filter out some information with storage devices? I did passthrough other devices which worked without issues work (example: headset and built-in webcam).
Any gotchas with KVM passthrough devices you’ve encountered where the device behaves differently within a VM than being attached directly to the host? I’m looking to get cozy with KVM and understand it well for all types of virtualization scenarios.
No, the problem is that the Windows VM sees a USB mass storage device, not a SATA drive, which means you cannot issue ATA SMART commands to the drive as-is, you would need to pass the entire USB host controller using PCI passthrough from the host to the guest for Windows to load its native xHCI driver instead, but even this still does not guarantee ATA SMART command forwarding success between the drive and guest utilities.
Plenty, here is a small list:
The host needs to unmount the drive before passing it off to the guest, otherwise drive enumeration failures and/or erratic behaviour will likely occur on the guest
Similarly, state carry-over to the guest may lead to an unexpected state if you initialized the USB bridge on the host before handoff, so you may need to replug the adapter and/or use a USB port controlled by its own root hub to force a state reset
USB passthrough may lead to different USB speed negotiation on the guest depending on the USB host controller’s port topology
Windows may load the older Bulk-Only Transport (usbstor) driver instead of UASP depending on the bridge’s implementation, of which the older driver lacks the SCSI/ATA Translation layer required for SMART passthrough in your use case