[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] How to get information about the guest filesystems by libguestfs

On Wed, Aug 05, 2009 at 03:30:07PM +0800, Zhang Qian wrote:
> Or I can call guestfs_list_partitions() and guestfs_lvs() to list all
> partitions and logic volumes in guest disk images, and for each of
> them call guestfs_exists() to check if the file I want exist, then
> modify the file.


Guest filesystem detection is non-trivial with many corner cases,
which is why we didn't write it in C, but wrote a higher level Perl
library to do it:


However you don't need to use this library, or Perl, directly.  You
can use virt-inspector to get an XML representation of the guest and


The example below is using a CentOS 5.3 virtual machine.  Note the
<mountpoints> section in the XML:

$ virt-inspector --xml CentOS5x32.img
      <mountpoint dev="/dev/VolGroup00/LogVol00">/</mountpoint>
      <mountpoint dev="/dev/sda1">/boot</mountpoint>
      <mountpoint dev="/dev/VolGroup00/LogVol01">swap</mountpoint>
      <filesystem dev="/dev/VolGroup00/LogVol00">
      <filesystem dev="/dev/VolGroup00/LogVol01">
      <filesystem dev="/dev/sda1">
[lots of other stuff omitted]


Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]