Bug 637251 - virt-inspector fails to recognize data-only NTFS disk image
virt-inspector fails to recognize data-only NTFS disk image
Status: NEW
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
Depends On:
  Show dependency treegraph
Reported: 2010-09-24 13:16 EDT by Eric Blake
Modified: 2011-04-12 13:44 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Eric Blake 2010-09-24 13:16:54 EDT
Description of problem:
I have a Windows VM set up with two disk images, c:\ containing the OS and d:\ containing data (mainly so that I can preserve data while nuking and reinstalling the OS).  However, while virt-manager correctly recognizes that the second image does not contain an OS, it fails to at least mention that it _did_ recognize a valid NTFS partition.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. set up a windows VM with two virtio disk images; one image for the OS becoming the virtual c:\, and another as the virtual d:\.
2. virt-inspector image1.img
3. virt-inspector image2.img
Actual results:
step 2: inspecting the OS image alone makes no mention that the OS mount table has mention of a d:\ drive:
# virt-inspector /mnt/backup/opt/libvirt/images/windows_2008.img 
windows i386 6.0 (Windows Server (R) 2008 Standard) on /dev/sda1:
    /dev/sda1                      /
      type: ntfs
      content: windows-root

step 3: inspecting the data image completely fails:
# virt-inspector /mnt/backup/opt/libvirt/images/data.img 
No operating system could be detected inside this disk image.

This may be because the file is not a disk image, or is not a virtual machine
image, or because the OS type is not understood by virt-inspector.

If you feel this is an error, please file a bug report including as much
information about the disk image as possible.

Expected results:
I'm not sure if it is possible to inspect the windows registry to see what cross-disk mount points windows expects to see, but it would be nice if inspecting image1 could tell me that the image depends on the existence of a d: mountpoint when loaded in a VM, similarly to how virt-inspector detects missing mountpoints for a two-image Linux guest.

More importantly, it would be nice if inspecting the data disk could display something like:
No operating system could be detected inside this disk image.
    /dev/sda1                      /
      type: ntfs
      content: data

rather than flat-out giving up when no OS is detected on any partition.

Additional info:
guestfish can successfully use both images in a single session:
# guestfish --ro -a /mnt/backup/opt/libvirt/images/windows_2008.img \
  -a /mnt/backup/opt/libvirt/images/data.img 

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for a list of commands
      'man' to read the manual
      'quit' to quit the shell

><fs> run
><fs> mkmountpoint /c
><fs> mkmountpoint /d
><fs> mount /dev/sda1 /c
><fs> mount /dev/sdb1 /d

at which point 'll /c /d' showed both windows root drive contents.
Comment 1 Richard W.M. Jones 2011-04-12 13:44:57 EDT
Sorry for losing track of this bug.

Firstly I'll note that you're using virt-inspector wrong.  If a
VM has two disks, then you have to present both of those disks
to virt-inspector at the same time, and in the same order that
they would appear to the regular guest.  Thus:

  virt-inspector image1.img image2.img

Now with libguestfs < something very very recent, that would still
have failed.  So the second point is that we've fixed the Windows
second drive problem (bug 674130), and provided support for
drive letters in the API (http://libguestfs.org/guestfs.3.html#guestfs_inspect_get_drive_mappings).

You will need the most recent version of libguestfs to
get these changes.

Note You need to log in before you can comment on or make changes to this bug.