Re: convert logical sector -> physical sector + pv/vg extent number

Andy Smith <[email protected]>
Newsgroups gmane.linux.lvm.general
Message-ID <[email protected]>
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
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.