5 virt-inspector - Display operating system version and other information about a virtual machine
9 virt-inspector [--options] -d domname
11 virt-inspector [--options] -a disk.img [-a disk.img ...]
15 virt-inspector domname
17 virt-inspector disk.img [disk.img ...]
21 B<virt-inspector> examines a virtual machine or disk image and tries
22 to determine the version of the operating system and other information
23 about the virtual machine.
25 Virt-inspector produces XML output for feeding into other programs.
27 In the normal usage, use C<virt-inspector -d domname> where C<domname> is
28 the libvirt domain (see: C<virsh list --all>).
30 You can also run virt-inspector directly on disk images from a single
31 virtual machine. Use C<virt-inspector -a disk.img>. In rare cases a
32 domain has several block devices, in which case you should list
33 several I<-a> options one after another, with the first corresponding
34 to the guest's C</dev/sda>, the second to the guest's C</dev/sdb> and
37 You can also run virt-inspector on install disks, live CDs, bootable
40 Virt-inspector can only inspect and report upon I<one domain at a
41 time>. To inspect several virtual machines, you have to run
42 virt-inspector several times (for example, from a shell script
45 Because virt-inspector needs direct access to guest images, it won't
46 normally work over remote libvirt connections.
48 All of the information available from virt-inspector is also available
49 through the core libguestfs inspection API (see
50 L<guestfs(3)/INSPECTION>). The same information can also be fetched
51 using guestfish or via libguestfs bindings in many programming
53 (see L<guestfs(3)/USING LIBGUESTFS WITH OTHER PROGRAMMING LANGUAGES>).
67 Add I<file> which should be a disk image from a virtual machine. If
68 the virtual machine has multiple block devices, you must supply all of
69 them with separate I<-a> options.
71 The format of the disk image is auto-detected. To override this and
72 force a particular format use the I<--format=..> option.
76 =item B<--connect URI>
78 If using libvirt, connect to the given I<URI>. If omitted,
79 then we connect to the default libvirt hypervisor.
81 Libvirt is only used if you specify a C<domname> on the
82 command line. If you specify guest block devices directly (I<-a>),
83 then libvirt is not used at all.
87 =item B<--domain> guest
89 Add all the disks from the named libvirt guest. Domain UUIDs can be
90 used instead of names.
94 When prompting for keys and passphrases, virt-inspector normally turns
95 echoing off so you cannot see what you are typing. If you are not
96 worried about Tempest attacks and there is no one else in the room you
97 can specify this flag to see what you are typing.
99 =item B<--format=raw|qcow2|..>
103 Specify the format of disk images given on the command line. If this
104 is omitted then the format is autodetected from the content of the
107 If disk images are requested from libvirt, then this program asks
108 libvirt for this information. In this case, the value of the format
109 parameter is ignored.
111 If working with untrusted raw-format guest disk images, you should
112 ensure the format is always specified.
114 =item B<--keys-from-stdin>
116 Read key or passphrase parameters from stdin. The default is
117 to try to read passphrases from the user by opening C</dev/tty>.
123 Enable verbose messages for debugging.
129 Display version number and exit.
133 Enable tracing of libguestfs API calls.
137 =head1 OLD-STYLE COMMAND LINE ARGUMENTS
139 Previous versions of virt-inspector allowed you to write either:
141 virt-inspector disk.img [disk.img ...]
145 virt-inspector guestname
147 whereas in this version you should use I<-a> or I<-d> respectively
148 to avoid the confusing case where a disk image might have the same
151 For compatibility the old style is still supported.
155 The virt-inspector XML is described precisely in a RELAX NG schema
156 file C<virt-inspector.rng> which is supplied with libguestfs. This
157 section is just an overview.
159 The top-level element is E<lt>operatingsystemsE<gt>, and it contains
160 one or more E<lt>operatingsystemE<gt> elements. You would only see
161 more than one E<lt>operatingsystemE<gt> element if the virtual machine
162 is multi-boot, which is vanishingly rare in real world VMs.
164 =head2 E<lt>operatingsystemE<gt>
166 In the E<lt>operatingsystemE<gt> tag are various optional fields that
167 describe the operating system, its architecture, the descriptive
168 "product name" string, the type of OS and so on, as in this example:
172 <root>/dev/sda2</root>
175 <distro>windows</distro>
176 <product_name>Windows 7 Enterprise</product_name>
177 <product_variant>Client</product_variant>
178 <major_version>6</major_version>
179 <minor_version>1</minor_version>
180 <windows_systemroot>/Windows</windows_systemroot>
181 <format>installed</format>
183 In brief, E<lt>nameE<gt> is the class of operating system (something
184 like C<linux> or C<windows>), E<lt>distroE<gt> is the distribution
185 (eg. C<fedora> but many other distros are recognized) and
186 E<lt>archE<gt> is the guest architecture. The other fields are fairly
187 self-explanatory, but because these fields are taken directly from the
188 libguestfs inspection API you can find precise information from
189 L<guestfs(3)/INSPECTION>.
191 The E<lt>rootE<gt> element is the root filesystem device, but from the
192 point of view of libguestfs (block devices may have completely
193 different names inside the VM itself).
195 =head2 E<lt>mountpointsE<gt>
197 Un*x-like guests typically have multiple filesystems which are mounted
198 at various mountpoints, and these are described in the
199 E<lt>mountpointsE<gt> element which looks like this:
205 <mountpoint dev="/dev/vg_f13x64/lv_root">/</mountpoint>
206 <mountpoint dev="/dev/sda1">/boot</mountpoint>
209 As with E<lt>rootE<gt>, devices are from the point of view of
210 libguestfs, and may have completely different names inside the guest.
211 Only mountable filesystems appear in this list, not things like swap
214 =head2 E<lt>filesystemsE<gt>
216 E<lt>filesystemsE<gt> is like E<lt>mountpointsE<gt> but covers I<all>
217 filesystems belonging to the guest, including swap and empty
218 partitions. (In the rare case of a multi-boot guest, it covers
219 filesystems belonging to this OS or shared with this OS and other
222 You might see something like this:
228 <filesystem dev="/dev/vg_f13x64/lv_root">
230 <label>Fedora-13-x86_64</label>
231 <uuid>e6a4db1e-15c2-477b-ac2a-699181c396aa</uuid>
234 The optional elements within E<lt>filesystemE<gt> are the filesystem
235 type, the label, and the UUID.
237 =head2 E<lt>applicationsE<gt>
239 The related elements E<lt>package_formatE<gt>,
240 E<lt>package_managementE<gt> and E<lt>applicationsE<gt> describe
241 applications installed in the virtual machine.
243 E<lt>package_formatE<gt>, if present, describes the packaging
244 system used. Typical values would be C<rpm> and C<deb>.
246 E<lt>package_managementE<gt>, if present, describes the package
247 manager. Typical values include C<yum>, C<up2date> and C<apt>
249 E<lt>applicationsE<gt> lists the packages or applications
257 <name>coreutils</name>
258 <version>8.5</version>
262 The version and release fields may not be available for some types
263 guests. Other fields are possible, see
264 L<guestfs(3)/guestfs_inspect_list_applications>.
266 =head2 E<lt>drive_mappingsE<gt>
268 For operating systems like Windows which use drive letters,
269 virt-inspector is able to find out how drive letters map to
276 <drive_mapping name="C">/dev/sda2</drive_mapping>
277 <drive_mapping name="E">/dev/sdb1</drive_mapping>
280 In the example above, drive C maps to the filesystem on the second
281 partition on the first disk, and drive E maps to the filesystem on the
282 first partition on the second disk.
284 Note that this only covers permanent local filesystem mappings, not
285 things like network shares. Furthermore NTFS volume mount points may
288 =head2 E<lt>iconE<gt>
290 Virt-inspector is sometimes able to extract an icon or logo for the
291 guest. The icon is returned as base64-encoded PNG data. Note that
292 the icon can be very large and high quality.
298 iVBORw0KGgoAAAANSUhEUgAAAGAAAABg[.......]
299 [... many lines of base64 data ...]
302 To display the icon, you have to extract it and convert the base64
303 data back to a binary file. Use an XPath query or simply an editor to
304 extract the data, then use the coreutils L<base64(1)> program to do
305 the conversion back to a PNG file:
307 base64 -i -d < icon.data > icon.png
309 =head2 INSPECTING INSTALL DISKS, LIVE CDs
311 Virt-inspector can detect some operating system installers on
312 install disks, live CDs, bootable USB keys and more.
314 In this case the E<lt>formatE<gt> tag will contain C<installer>
315 and other fields may be present to indicate a live CD, network
316 installer, or one part of a multipart CD. For example:
320 <root>/dev/sda</root>
323 <distro>ubuntu</distro>
324 <product_name>Ubuntu 10.10 "Maverick Meerkat"</product_name>
325 <major_version>10</major_version>
326 <minor_version>10</minor_version>
327 <format>installer</format>
332 You can use the XPath query language, and/or the xpath tool, in order
333 to select parts of the XML.
337 $ virt-inspector -d Guest | xpath //filesystems
341 <filesystem dev="/dev/vg_f13x64/lv_root">
345 $ virt-inspector -d Guest | \
346 xpath "string(//filesystem[@dev='/dev/sda1']/type)"
347 Query didn't return a nodeset. Value: ext4
351 Libvirt guest names can contain arbitrary characters, some of which
352 have meaning to the shell such as C<#> and space. You may need to
353 quote or escape these characters on the command line. See the shell
354 manual page L<sh(1)> for details.
356 =head1 OLD VERSIONS OF VIRT-INSPECTOR
358 Early versions of libguestfs shipped with a different virt-inspector
359 program written in Perl (the current version is written in C). The
360 XML output of the Perl virt-inspector was different and it could also
361 output in other formats like text.
363 The old virt-inspector is no longer supported or shipped with
366 To confuse matters further, in Red Hat Enterprise Linux 6 we ship two
367 versions of virt-inspector with different names:
369 virt-inspector Old Perl version.
370 virt-inspector2 New C version.
376 L<http://www.w3.org/TR/xpath/>,
378 L<http://libguestfs.org/>.
386 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
390 Matthew Booth L<mbooth@redhat.com>
396 Copyright (C) 2010-2011 Red Hat Inc.
398 This program is free software; you can redistribute it and/or modify
399 it under the terms of the GNU General Public License as published by
400 the Free Software Foundation; either version 2 of the License, or
401 (at your option) any later version.
403 This program is distributed in the hope that it will be useful,
404 but WITHOUT ANY WARRANTY; without even the implied warranty of
405 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
406 GNU General Public License for more details.
408 You should have received a copy of the GNU General Public License
409 along with this program; if not, write to the Free Software
410 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.