0

At the present moment, my guest is running inside qemu and host is kvm intel, running Ubuntu 14.04, kernel is 4.3.0 stable. From within the guest, when I run "hdparm -i /dev/sdb" on the guest, I get:

HDIO_GET_IDENTITY failed: Invalid argument

as the error,but on the host, I will get the full harddisk/SSD info.

Can I know how to resolve this so that the output is the same for both host and guest?

My strace of hdparm from within the guest (just "-e ioctl" is traced):

ioctl(3, HDIO_GET_MULTCOUNT, 0x618ef0)  = -1 EINVAL (Invalid argument)
ioctl(3, SG_IO, {'S', SG_DXFER_FROM_DEV, cmd[16]=[85, 08, 0e, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 40, ec, 00], mx_sb_len=32, iovec_count=0, dxfer_len=512, timeout=15000, flags=0, data[512]=["@\0\377?7\310\20\0\0\0\0\0?\0\0\0\0\0\0\0HPAD0409105B"...], status=00, masked_status=00, sb[0]=[], host_status=0, driver_status=0, resid=0, duration=184, info=0}) = 0
ioctl(3, HDIO_GET_IDENTITY, 0x7fffda088500) = -1 EINVAL (Invalid argument)
 HDIO_GET_IDENTITY failed: Invalid argument
+++ exited with 22 +++

And at the host level:

ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd4b096d90) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, HDIO_GET_MULTCOUNT, 0x618ef0)  = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, SG_IO, {'S', SG_DXFER_FROM_DEV, cmd[16]=[85, 08, 0e, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 40, ec, 00], mx_sb_len=32, iovec_count=0, dxfer_len=512, timeout=15000, flags=0, data[512]=["@\0\377?7\310\20\0\0\0\0\0?\0\0\0\0\0\0\0HPAD0409105B"...], status=00, masked_status=00, sb[0]=[], host_status=0, driver_status=0, resid=0, duration=184, info=0}) = 0
**ioctl(3, HDIO_GET_IDENTITY, 0x7ffd4b0976e0) = 0**
+++ exited with 0 +++

And my qemu command line:

sudo ./x86_64-softmmu/qemu-system-x86_64 -m 1024 -boot c -enable-kvm -net nic -net user \
-device virtio-scsi-pci \
-drive if=none,file=/dev/sdb,id=sdb,cache=none,format=raw \
-device scsi-block,drive=sdb \
-hda /home/user/ubuntu1404_x86_64/ubuntu1404_x86_64.img

where qemu-system_x86_64 is freshly compiled from latest qemu-devel git tree.

I would like the SSD (internal SATA) at /dev/sdb to be pass directly into qemu.

Please kindly recommend the best solution: distro (CentOS??), kernel version, qemu command like, and setup procedure for libvirtd? or virtio-scsi? Identical output for "hdparm" will be the main criteria.

1 Answer 1

2

If you want the exact same output, you need a separate disk controller with a separate disk attached, connected via pci-passthrough to the guest.

A virtio disk image is NOT the same disk as the physical drive it resides on. It's just an image, with it's own metadata. The virtio framework probably doesn't even supply the metadata hdparm queries for, because it isn't there for that purpose.

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .