Red Hat Bugzilla – Bug 1349237
virt-inspector can not get windows drive letters for GPT disks
Last modified: 2016-11-03 14:01:53 EDT
Created attachment 1171226 [details] log.virt-inspector-win8 Description of problem: I prepared a Windows8.1 image with GPT disk, but I can't get the drive letters using virt-inspector. Windows7 also has the same problem. You can see the full log with -v -x in the attachment. Version-Release number of selected component (if applicable): libguestfs-1.32.5-3.el7.x86_64 How reproducible: Always Steps to Reproduce: 1. Prepare an Windows8.1 image with GPT disk: First, prepare a Win8 iso. Then, download and install OVMF ( The UEFI firmware for virtual machines). Then, use virt-manager to install Win8: --Create a new virtual machine , and choose “Customize configuration before install” --At Overview tab—Hypervisor Details-- Firmware, choose: “UEFI x86_64:/usr/share/OVMF/OVMF_CODE.fd" At last, install it according to the guide. 2. Inspect the Win8 image: # virt-inspector -a /home/xchen/my-images/win8.1-uefi.qcow2 <?xml version="1.0"?> <operatingsystems> <operatingsystem> <root>/dev/sda4</root> <name>windows</name> <arch>x86_64</arch> <distro>windows</distro> <product_name>Windows 8.1 Enterprise</product_name> <product_variant>Client</product_variant> <major_version>6</major_version> <minor_version>3</minor_version> <windows_systemroot>/Windows</windows_systemroot> <windows_current_control_set>ControlSet001</windows_current_control_set> <hostname>WIN-NKLFAJFC4EN</hostname> <format>installed</format> <mountpoints> <mountpoint dev="/dev/sda4">/</mountpoint> </mountpoints> <filesystems> <filesystem dev="/dev/sda4"> <type>ntfs</type> <uuid>468ADC538ADC40DB</uuid> </filesystem> </filesystems> <applications/> </operatingsystem> </operatingsystems> There should be lines like in win7 with MBR as following: <drive_mappings> <drive_mapping name="C">/dev/sda1</drive_mapping> </drive_mappings> Actual results: As above output. Expected results: There should be lines like in win7 with MBR as following: <drive_mappings> <drive_mapping name="C">/dev/sda1</drive_mapping> </drive_mappings> Additional info: Win7 also have this problem.
The drive mappings are stored in the Windows SYSTEM hive, so can you grab the SYSTEM hive from the guest for me please. You just need to do this command: guestfish --ro -a /home/xchen/my-images/win8.1-uefi.qcow2 -i \ download 'win:\windows\system32\config\system' /tmp/system and then attach the /tmp/system file to this bug (if it's too big to attach you may have to compress it).
Created attachment 1171406 [details] system
I think this one should be fixed by: commit 7cb28488a6b974c86a9dd0264d892cd01739c36e Author: Dawid Zamirski <*@*> Date: Sat Feb 6 11:50:05 2016 -0500 inspect: get windows drive letters for GPT disks. This patch updates the guestfs_inspect_get_drive_mappings API call to also return drive letters for GPT paritions. Previously this worked only for MBR partitions. This is achieved by matching the GPT partition GUID with the info stored in the blob from HKLM\SYSTEM\MountedDevices\DosDevices keys. For GPT partions this blob contains a "DMIO:ID:" prefix followed by a 16 byte binary GUID.
Verified with the packages: libguestfs-1.32.5-6.el7.x86_64 Verify steps: 1. Prepare an Windows8.1 image with GPT disk: First, prepare a Win8 iso. Then, download and install OVMF ( The UEFI firmware for virtual machines). Then, use virt-manager to install Win8: --Create a new virtual machine , and choose “Customize configuration before install” --At Overview tab—Hypervisor Details-- Firmware, choose: “UEFI x86_64:/usr/share/OVMF/OVMF_CODE.fd" At last, install it according to the guide. 2. Inspect the Win8 image: # virt-inspector -a /home/xchen/my-images/win8.1-uefi.qcow2 <?xml version="1.0"?> <operatingsystems> <operatingsystem> <root>/dev/sda4</root> <name>windows</name> <arch>x86_64</arch> <distro>windows</distro> <product_name>Windows 8.1 Enterprise</product_name> <product_variant>Client</product_variant> <major_version>6</major_version> <minor_version>3</minor_version> <windows_systemroot>/Windows</windows_systemroot> <windows_current_control_set>ControlSet001</windows_current_control_set> <hostname>xchen</hostname> <format>installed</format> <mountpoints> <mountpoint dev="/dev/sda4">/</mountpoint> </mountpoints> <filesystems> <filesystem dev="/dev/sda4"> <type>ntfs</type> <uuid>468ADC538ADC40DB</uuid> </filesystem> </filesystems> <drive_mappings> <drive_mapping name="C">/dev/sda4</drive_mapping> </drive_mappings> <applications/> </operatingsystem> </operatingsystems> There is drive_mapping info . So verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2576.html