Linux LVM users
 help / color / mirror / Atom feed
* [linux-lvm] How Can I modify the mapping PE to LE??
@ 2006-06-07 13:13 조완근
  2006-06-07 14:10 ` Dieter Stüken
  2006-06-09  8:24 ` Zac Slade
  0 siblings, 2 replies; 3+ messages in thread
From: 조완근 @ 2006-06-07 13:13 UTC (permalink / raw)
  To: linux-lvm

[-- Attachment #1: Type: text/plain, Size: 1479 bytes --]





Hello, I'm at the beginning to use LVM in my machine.


 


Could you give any information on the implementation details of LVM and 
device mapper?? More specifically, I want to change the "mapping between PE and 
LE" for some purposes, however I'm just finished to read the manual of 
LVM-HowTO. This means that I'm totally a newbie in LVM and device-mapper. I 
just read some codes on data 
structures in LVM2/lib/metadata/metadata.h, but I can't get more 
information anymore on how they are mapped.


 


I was hanging around the codes in LVM2 source to find the part related 
with the "mapping", I just got to know the mapping information is stored in 
device mapper, not in the LVM. 


 


I'll use LVM for this purpose - I would like to make a program 
to change the mapping relationship between PE and LE in my own. In 
fact, the program's goal is to move an extent in a bad disk to a disk with 
good performance. The movement is done by the extent. In order to do it, I 
definitely, have to know how I can modify the mapping and maybe, the entire 
structure of LVM and device mapper.


 


Could you give me some information on LVM & device-mapper details that 
help me??


- exactly all about the mapping between LE & PE..


I'm totally at the beginning, I'm well prepared to dig in the codes from now 
on, does anyone can help me to run faster??






[-- Attachment #2: Type: text/html, Size: 1964 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] How Can I modify the mapping PE to LE??
  2006-06-07 13:13 [linux-lvm] How Can I modify the mapping PE to LE?? 조완근
@ 2006-06-07 14:10 ` Dieter Stüken
  2006-06-09  8:24 ` Zac Slade
  1 sibling, 0 replies; 3+ messages in thread
From: Dieter Stüken @ 2006-06-07 14:10 UTC (permalink / raw)
  To: jowkju, LVM general discussion and development

조완근 wrote:
> Hello, I'm at the beginning to use LVM in my machine.
>
> Could you give any information on the implementation details of LVM and 
> device mapper?? More specifically, I want to change the "mapping between 
> PE and LE" for some purposes, however I'm just finished to read the 
> manual of LVM-HowTO. This means that I'm totally a newbie in LVM and 
> device-mapper. I just read some codes on data 
> ...
> I'll use LVM for this purpose - I would like to make a program to change the 
> mapping relationship between PE and LE in my own. In fact, the program's goal
> is to move an extent in a bad disk to a disk with good performance. The movement 
> is done by the extent. In order to do it, I definitely, have to know how I can 
> modify the mapping and maybe, the entire structure of LVM and device mapper.

Hmm, are you realy finished to read the manual :-)

Sounds to me like you reinvent the "pvmove" command.
This is not "some purpose" but a central task
LVM performs for you on demand!

regards, Dieter.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] How Can I modify the mapping PE to LE??
  2006-06-07 13:13 [linux-lvm] How Can I modify the mapping PE to LE?? 조완근
  2006-06-07 14:10 ` Dieter Stüken
@ 2006-06-09  8:24 ` Zac Slade
  1 sibling, 0 replies; 3+ messages in thread
From: Zac Slade @ 2006-06-09  8:24 UTC (permalink / raw)
  To: jowkju, LVM general discussion and development

On Wednesday 07 June 2006 08:13, 조완근 wrote:
> Hello, I'm at the beginning to use LVM in my machine.
Congrats!

> Could you give any information on the implementation details of LVM and
> device mapper?? More specifically, I want to change the "mapping between PE
> and LE" for some purposes, however I'm just finished to read the manual of
> LVM-HowTO. This means that I'm totally a newbie in LVM and
> device-mapper. I just read some codes on data
> structures in LVM2/lib/metadata/metadata.h, but I can't get more
> information anymore on how they are mapped.
Well really it's down to basic concepts here.  A physical volume is created 
using some backing store (block device).  The pv is then put into a volume 
group where it is split into PEs (Physical Extents) that are then used to 
create logical volumes.  Logical volumes are split up into LE (Logical 
Extents) which are the same size as the volume groups PE size.  The idea is 
that any LE can be on a PE from any pv in the volume group.  (make sense?)

Now if you wish to discover which LEs map to which PEs (and in turn what 
disks) you need to use lvdisplay -m vg/lv and this will give you each set of 
extent ranges and what PE/PVs they map to.  Here is an example:
ath600 sbin # lvdisplay -m main/var
  --- Logical volume ---
  LV Name                /dev/main/var
  VG Name                main
  LV UUID                Qq9ywx-zPNR-mbhn-LcZ4-7ZEV-AJhF-42wDk1
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                8.00 GB
  Current LE             2048
  Segments               3
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:2

  --- Segments ---
  Logical extent 0 to 511:
    Type                linear
    Physical volume     /dev/sda3
    Physical extents    30976 to 31487

  Logical extent 512 to 1279:
    Type                linear
    Physical volume     /dev/sdb
    Physical extents    25725 to 26492

  Logical extent 1280 to 2047:
    Type                linear
    Physical volume     /dev/sda3
    Physical extents    45056 to 45823

So you can clearly see that both /dev/sda3 and sdb are spanned for this 
logical volume.  You can see which LEs map to which PEs.

> I'll use LVM for this purpose - I would like to make a
> program to change the mapping relationship between PE and LE in my own. In
> fact, the program's goal is to move an extent in a bad disk to a disk
> with good performance. The movement is done by the extent. In order to
> do it, I definitely, have to know how I can modify the mapping and maybe,
> the entire structure of LVM and device mapper.
Okay this is actually already done.  You are looking for pvmove.  Check its 
man page.  If you want to move all allocated extents from a slow drive to a 
faster one it's quite easy, just do pvmove /dev/slowdisk /dev/fastdisk.  
However if you just want to move extents from some LVs then you'll need the 
much more advanced, pvmove /dev/slowdisk:beginextent-endextent /dev/fastdisk, 
version of the command.  Use the output of lvdisplay -m to guide you in the 
extents.

> Could you give me some information on LVM & device-mapper details that
> help me??
Not sure you need these details, just more fundamental knowledge of the 
concepts and of what the userland tools can do for you.

> I'm totally at the beginning, I'm well prepared to dig in the codes from
> now on, does anyone can help me to run faster??
No need to read the code unless you really really really get stuck and this 
list can't help you.  And if you've made it that far then someone on this 
list will surely be of good service as a starting point.

If you really want to run faster you can move data that is touched often onto 
faster disks with pvmove.  Also making volumes contiguously helps and you can 
use pvmove to make existing logical volumes contiguous as well.  I'll leave 
that as an excercise for the reader.

Hope That helps!

-- 
Zac Slade
krakrjak@volumehost.net
ICQ:1415282 YM:krakrjak AIM:ttyp99

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-09  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-07 13:13 [linux-lvm] How Can I modify the mapping PE to LE?? 조완근
2006-06-07 14:10 ` Dieter Stüken
2006-06-09  8:24 ` Zac Slade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox