* [linux-lvm] Mapping LVs to physical device
@ 2009-06-30 17:17 Chris Farey
2009-06-30 18:54 ` Milan Broz
2009-06-30 19:07 ` Stuart D. Gathman
0 siblings, 2 replies; 3+ messages in thread
From: Chris Farey @ 2009-06-30 17:17 UTC (permalink / raw)
To: linux-lvm
I have a requirement to be able to work out which areas of a physical
device assigned to LVM are being used by various logical volumes. I
haven't found any easy way to do this using an API, so I've resorted to
spawning off lvm commands and interpretting the output.
I can use lvdisplay to map logical extents to physical extents, but I
still need to know where the extents start on the physical device, and I
can't find a good way of doing that.
pvck tells me the offset and the size of the metadata, and assuming that
the first extent starts after the metadata seems to work. But pvck
doesn't seem to be present in older versions of LVM (or one of my
systems starts running them gets killed), and the help implies its doing
some checks too (and lengthly checks would be bad in my application).
Is there a better way to map the Logical Block Addresses of LVs to
physical disks?
Chris Farey
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-lvm] Mapping LVs to physical device
2009-06-30 17:17 [linux-lvm] Mapping LVs to physical device Chris Farey
@ 2009-06-30 18:54 ` Milan Broz
2009-06-30 19:07 ` Stuart D. Gathman
1 sibling, 0 replies; 3+ messages in thread
From: Milan Broz @ 2009-06-30 18:54 UTC (permalink / raw)
To: LVM general discussion and development
Chris Farey wrote:
> I have a requirement to be able to work out which areas of a physical
> device assigned to LVM are being used by various logical volumes. I
> haven't found any easy way to do this using an API, so I've resorted to
> spawning off lvm commands and interpretting the output.
you can report all attributes using pvs/lvs/vgs, like this
pvs -o +devices
lvs --segments -o +seg_pe_ranges
... for list of available attributes just run "pvs -o help"
Milan
--
mbroz@redhat.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-lvm] Mapping LVs to physical device
2009-06-30 17:17 [linux-lvm] Mapping LVs to physical device Chris Farey
2009-06-30 18:54 ` Milan Broz
@ 2009-06-30 19:07 ` Stuart D. Gathman
1 sibling, 0 replies; 3+ messages in thread
From: Stuart D. Gathman @ 2009-06-30 19:07 UTC (permalink / raw)
To: LVM general discussion and development
On Tue, 30 Jun 2009, Chris Farey wrote:
> I have a requirement to be able to work out which areas of a physical device
> assigned to LVM are being used by various logical volumes. I haven't found any
> easy way to do this using an API, so I've resorted to spawning off lvm
> commands and interpretting the output.
It is also useful to go the other way: given a physical sector, figure out
which LV it is in and the offset. When there is a physical disk error
(and no mirroring or such), it is useful to map it to an offset in a LV,
and then to a file. Modern disks can "heal" themselves by writing over
the sector (copying, repairing or replacing, and then overwriting the file).
--
Stuart D. Gathman <stuart@bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-30 19:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-30 17:17 [linux-lvm] Mapping LVs to physical device Chris Farey
2009-06-30 18:54 ` Milan Broz
2009-06-30 19:07 ` Stuart D. Gathman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.