On Wed, Aug 01, 2012 at 01:19:45PM -0500, Shawn Kennedy wrote:
Hi Richard,
Because I have 2 filesystems (one in a mounted LV and one in a unmounted
LV), I get 2 sets of mountpoints in virt-inspector2 ....
<mountpoints>
<mountpoint dev="/dev/VG1/LV0001.root">/</mountpoint>
<mountpoint dev="/dev/VG1/LV0001.var">/var</mountpoint>
<mountpoint dev="/dev/VG1/LV0001.app1">/app1</mountpoint>
<mountpoint dev="/dev/sda1">/boot</mountpoint>
<mountpoint dev="/dev/VG1/home">/home</mountpoint>
<mountpoint dev="/dev/VG1/logs">/logs</mountpoint>
<mountpoint dev="/dev/VG1/cores">/cores</mountpoint>
<mountpoint dev="/dev/VG1/storage">/storage</mountpoint>
</mountpoints>
<mountpoints>
<mountpoint dev="/dev/VG1/LV0002.root">/</mountpoint>
<mountpoint dev="/dev/VG1/LV0002.var">/var</mountpoint>
<mountpoint dev="/dev/VG1/LV0002.app1">/app1</mountpoint>
<mountpoint dev="/dev/sda1">/boot</mountpoint>
<mountpoint dev="/dev/VG1/home">/home</mountpoint>
<mountpoint dev="/dev/VG1/logs">/logs</mountpoint>
<mountpoint dev="/dev/VG1/cores">/cores</mountpoint>
<mountpoint dev="/dev/VG1/storage">/storage</mountpoint>
</mountpoints>
virt-inspector is hopefully seeing two separate <operatingsystem>'s
here.
So, which one is the real one?? If I log into the guest directly,
I know the /dev/VG1/LV0002* is the mounted partition (by
using 'mount' command or by examining /etc/fstab).
So I think what you're asking is, what root device is currently
mounted in the running guest, when you're inspecting the guest from
outside (hopefully read-only) using libguestfs.
This isn't something that libguestfs can know since all it can see is
what is in the disks, not the state of the running guest itself. But
there are some heuristics you could use instead:
(1) You could look at tell-tale signs to see which root device has
most recently been mounted. Probably the simplest thing is to look at
the date of /var/log/messages in each potential root, and choose the
most recent one (since /var/log/messages is reliably and frequently
updated when a guest boots and runs).
(2) You could try doing what virt-v2v does, which is to parse the grub
configuration to find out what root parameter is being passed to the
kernel at boot time. I believe this is the code ...
http://git.fedorahosted.org/git/?p=virt-v2v.git;a=blob;f=lib/Sys/VirtConv...
(from the guest)
# mount | grep root
/dev/mapper/VG1-LV0002.root on / type ext3 (rw)
As much as I would like to, we cannot move the RHEL release to
the next release. Project restrictions and all ... :-)
Lastly, where is 'guestfish' installed on the system?? It's not installed
on my system, even though I have installed the RHEL6.2 RPMs.
# rpm -qa | grep libguest
python-libguestfs-1.7.17-26.el6.x86_64
libguestfs-1.7.17-26.el6.x86_64
libguestfs-tools-c-1.7.17-26.el6.x86_64
libguestfs-mount-1.7.17-26.el6.x86_64
libguestfs-tools-1.7.17-26.el6.x86_64
# guestfish
-bash: guestfish: command not found
That's odd. It should be in libguestfs-tools-c. Try:
rpm -ql libguestfs-tools-c | grep guestfish
and check that your $PATH is set correctly.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top