19.10. Accessing Data on Guest Disk Image
You can use two separate applications that assist you in
accessing data from within a guest disk image. Before using
these tools, you must shut down the guests. Accessing the file
system from the guest and dom0 could potentially harm your
system.
You can use the kpartx application to handle partitioned disks or LVM volume groups:
yum install kpartx
kpartx -av /dev/xen/guest1
add map guest1p1 : 0 208782 linear /dev/xen/guest1 63
add map guest1p2: 0 16563015 linear /dev/xen/guest1 208845
To access LVM volumes on a second partiton, you must rescan
LVM with vgscan and activate the volume group on the partition
(called VolGroup00 by default) by using the vgchange -ay
command:
# kpartx -a /dev/xen/guest1
#vgscan
Reading all physical volumes . This may take a while...
Found volume group "VolGroup00" using metadata type 1vm2
# vgchange -ay VolGroup00now
2 logical volume(s) in volume group VolGroup00 now active.
# lvs
LV VG Attr Lsize Origin Snap% Move Log Copy%
LogVol00 VolGroup00 -wi-a- 5.06G
LogVol01 VolGroup00 -wi-a- 800.00M
# mount /dev/VolGroup00/LogVol00 /mnt/
....
#umount /mnt/
#vchange -an VolGroup00
#kpartx -d /dev/xen/guest1
You must remember to deactivate the logical volumes with
vgchange -an, remove the partitions with kpartx-d , and
delete the loop device with losetup -d when you finish.