Use libguestfs to view devices and filesystems in a VM

Here is a small C program (examples/to-xml.c) which uses libguestfs to examine a virtual machine and produce a little XML display of the partitions, LVM data and filesystems within the virtual machine.

This XML is fanciful. Is there a standard XML description for this sort of thing?


$ examples/to-xml RHEL52PV32-tmp.img | tidy -xml -i -q
    <device dev="/dev/sda">
        <partition dev="/dev/sda1">
          <fs type="ext3">
        <partition dev="/dev/sda2">
          <physvol />
    <volgroup name="VolGroup00">
      <logvol name="/dev/VolGroup00/LogVol00">
        <fs type="ext3">
      <logvol name="/dev/VolGroup00/LogVol01">
        <linux-swap />

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s