[linux-lvm] convert logical sector -> physical sector + pv/vg extent number
Andy Smith
andy at strugglers.net
Sun Jan 2 23:12:42 UTC 2022
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
More information about the linux-lvm
mailing list