So the problem was that the losetup doesn't able to handle the 'm' char...
So the right command:
losetup -f -v -o $((47105 * 1024 * 1024)) /dev/sda2
Regards,
B
2012. március 31. 18:56 Bali Zaci írta, <zaci.bali@gmail.com>:
Hi all,I have the following setup: pv (/dev/sda2) -> vg (name: vg) -> lv (name: test)I would like to create a loopback device on /dev/sda2 (using offset) so the loopback will be exactly the test logical volume.It is working with a testfile but somehow It is not working with a "real device".So the steps are the following:1., Clean the lv and create a pattern that I should find at the begin of the loopback device# dd if=/dev/zero of=/dev/mapper/vg-test# echo 'AAAA' > /dev/mapper/vg-test# sync# hexdump -C -n 10 /dev/mapper/vg-test00000000 41 41 41 41 0a 00 00 00 00 00 |AAAA......|0000000a2., Check the PE size (4M)# pvdisplay |grep 'PE Size'PE Size 4.00 MiB3., Check where is the first PE on the partition (1M)# pvs -o +pe_startPV VG Fmt Attr PSize PFree 1st PE/dev/sda2 vg lvm2 a-- 465.56g 0 1.00m4., Check where the lv is located on the pv (starting at the 11776 PE)# lvdisplay -m vg/test--- Logical volume ---LV Name /dev/vg/testVG Name vgLV UUID vT5X5z-1CJH-uw4n-Jcs8-DW50-PDDB-N6PlIuLV Write Access read/writeLV Status available# open 0LV Size 419.56 GiBCurrent LE 107408Segments 1Allocation inheritRead ahead sectors auto- currently set to 256Block device 253:4--- Segments ---Logical extent 0 to 107407:Type linearPhysical volume /dev/sda2Physical extents 11776 to 1191835., Create a loopback device on /dev/sda2 (pv) with offset based on the following calculation: Where is the first PE on the device (1M) + Where is the firt PE of the test lv (11776)*PE size (4M) = 47105M# losetup -f -v -o 47105m /dev/sda2Loop device is /dev/loop06., Test it with hexdump (it should give the same result like in the firts step but id doesn't do it)# hexdump -C -n 10 /dev/loop000000000 00 00 00 00 00 00 00 00 00 00 |..........|0000000aCould somebody give me a hint where is the problem?Thanks and regards,B
_______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/