[linux-lvm] convert logical sector -> physical sector + pv/vg extent number

Roland devzero at web.de
Mon Jan 3 11:13:23 UTC 2022


thanks!

any chance to get retrieve this information for automated/script based
processing ?

roland


Am 03.01.22 um 00:12 schrieb Andy Smith:
> Hi Roland,
>
> On Sun, Jan 02, 2022 at 08:00:30PM +0100, Roland wrote:
>> if i have a logical sector/block "x" on a lvm logical volume ,  is there
>> a way to easily calculate/determine (optimally by script/cli) the
>> corresponding physical sector of the physical device it belongs to and
>> the extent number of the appropiate pv/vg where it resides ?
> lvdisplay --maps /path/to/lv
>
> tells you all the mappings of logical extents within the LV to
> physical extents within the PV.
>
> pvdisplay --units s /dev/yourpv | grep 'PE Size'
>
> tells you the size of a physical extent in sectors.
>
> Between those you can work out the sector number on the physical
> device for a sector number on a logical volume.
>
> Cheers,
> Andy
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://listman.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>





More information about the linux-lvm mailing list