I'm not sure what you're trying to do. If you have a vmdk file, can't you simply fire up (start) a VM and mount the lvm? Why try to yank info from a flat file?<br><br clear="all">-- Asher <br>
<br><br><div class="gmail_quote">On Fri, Sep 18, 2009 at 5:01 PM, <span dir="ltr"><<a href="mailto:brian@polibyte.com">brian@polibyte.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I have a file that's a disk image of a standard RHEL4 install. In this file<br>
are two partitions. The second partition contains a logical volume. I'd<br>
like to access the filesystem in that logical volume. I'm trying to create<br>
a loopback device that refers to the second partition so that I can use the<br>
standard lvm tools to set it up. I can't use the max_part option for the<br>
loopback module since my kernel is too old. Therefore, I think I have to<br>
manually calculate the offset of the second partition in the file and pass<br>
that to losetup. However, I get some warnings from fdisk when I'm trying to<br>
figure out the offset, and after I set up the loopback device the lvm tools<br>
don't detect anything. Anyone have any suggestions? More details are below.<br>
<br>
# First, set up the "flat" file to represent the disk.<br>
<br>
$ vmware-mount -f thedisk.vmdk /mnt/vm1/<br>
<br>
# Next, get details about the partitions.<br>
<br>
$ fdisk -l /mnt/vm1/flat<br>
last_lba(): I don't know how to handle files with mode 8180<br>
You must set cylinders.<br>
You can do this from the extra functions menu.<br>
<br>
Disk /mnt/vm1/flat: 0 MB, 0 bytes<br>
255 heads, 63 sectors/track, 0 cylinders<br>
Units = cylinders of 16065 * 512 = 8225280 bytes<br>
<br>
Device Boot Start End Blocks Id System<br>
/mnt/vm1/flat1 * 1 13 104391 83 Linux<br>
/mnt/vm1/flat2 14 4177 33447330 8e Linux LVM<br>
Partition 2 has different physical/logical endings:<br>
phys=(1023, 254, 63) logical=(4176, 254, 63)<br>
<br>
# Multiply the start of the lvm partition by the units to get the offset.<br>
8225280 * 14 is 115153920, so I try to mount the loopback device with<br>
that offset.<br>
<br>
$ losetup /dev/loop0 /mnt/vm1/flat -o 115153920<br>
<br>
# However, when I run pvscan or vgscan loop0 isn't recognized.<br>
<br>
#device/dev-io.c:486 Opened /dev/loop0 RO<br>
#device/dev-io.c:260 /dev/loop0: size is 66883954 sectors<br>
#device/dev-io.c:532 Closed /dev/loop0<br>
#device/dev-io.c:260 /dev/loop0: size is 66883954 sectors<br>
#device/dev-io.c:486 Opened /dev/loop0 RW O_DIRECT<br>
#device/dev-io.c:134 /dev/loop0: block size is 1024 bytes<br>
#device/dev-io.c:532 Closed /dev/loop0<br>
#filters/filter-composite.c:31 Using /dev/loop0<br>
#device/dev-io.c:486 Opened /dev/loop0 RW O_DIRECT<br>
#device/dev-io.c:134 /dev/loop0: block size is 1024 bytes<br>
#label/label.c:184 /dev/loop0: No label detected<br>
#device/dev-io.c:532 Closed /dev/loop0<br>
<br>
All the best,<br>
Brian Pitts<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
</blockquote></div><br>