Skip to contentSkip to conversation

Allocation maps of a mirrored LV?

linux-lvm Lupe Christoph 3 participants 5 messages Jan 13, 2009 – Jan 15, 2009

lore
Share & tools
lore
#0 lore raw

Hi!

I'm about to integrate support for LVM mirrors into the configuration management system I'm maintaining for a client. This system has a "scan" function that retrieves the current configuration and compares it against a database.

My problem is that I'm unable to get the allocation info for the parts of a mirrored volume under SLES 10 (lvm2 RPM is at 2.02.17, even OpenSuSE 10.3 has only lvm2 2.02.25).

lvdisplay --maps only gives me:

--- Segments ---
Logical extent 0 to 24:
Type mirror
Mirrors 2
Mirror size 25
Mirror log volume testlv0_mlog
Mirror region size 512.00 KB
Mirror original:
Logical volume testlv0_mimage_0
Logical extents 0 to 24
Mirror destinations:
Logical volume testlv0_mimage_1
Logical extents 0 to 24

This is lacking the names of the PVs. (Has this been implemented in the meantime? It would be useful - nudge, nudge...)

BTW, a simple volume *has* this information:

--- Segments ---
Logical extent 0 to 31:
Type linear
Physical volume /dev/sda3
Physical extents 1261 to 1292

I'm unable to convince lvdisplay to give me any information on, e.g., testlv0_mimage_0. And pvdisplay --maps does not display allocation maps up to 2.02.27, AFAIK.

So does anybody have a way to find out on which PV the mirror parts are? Short of installing our own lvm2 RPM, of course. Or parsing the raw LVM config info on the disks...

Thanks for any hint,
Lupe Christoph

Signature · 2 lines
| There is no substitute for bad design except worse design.             |
| /me                                                                    |
#1 lore raw
Quoted 7 lines · Lupe Christoph

Hi!

I'm about to integrate support for LVM mirrors into the configuration management system I'm maintaining for a client. This system has a "scan" function that retrieves the current configuration and compares it against a database.

Quoted 5 lines

My problem is that I'm unable to get the allocation info for the parts of a mirrored volume under SLES 10 (lvm2 RPM is at 2.02.17, even OpenSuSE 10.3 has only lvm2 2.02.25).

lvdisplay --maps only gives me:

Try pvs/vgs/lvs instead (and use -o to get the details you want):

# pvs --segments
  PV         VG     Fmt  Attr PSize  PFree  Start SSize
  /dev/dm-0  laptop lvm2 a-   55.69G 32.00M     0   250
  /dev/dm-0  laptop lvm2 a-   55.69G 32.00M   250  1499
  /dev/dm-0  laptop lvm2 a-   55.69G 32.00M  1749    32
  /dev/dm-0  laptop lvm2 a-   55.69G 32.00M  1781     1

--Dave

#2 lore raw
Quoted 13 lines · David Robinson
Quoted 10 lines · Lupe Christoph

I'm about to integrate support for LVM mirrors into the configuration management system I'm maintaining for a client. This system has a "scan" function that retrieves the current configuration and compares it against a database.

My problem is that I'm unable to get the allocation info for the parts of a mirrored volume under SLES 10 (lvm2 RPM is at 2.02.17, even OpenSuSE 10.3 has only lvm2 2.02.25).

lvdisplay --maps only gives me:

Quoted 8 lines

Try pvs/vgs/lvs instead (and use -o to get the details you want):

# pvs --segments
  PV         VG     Fmt  Attr PSize  PFree  Start SSize
  /dev/dm-0  laptop lvm2 a-   55.69G 32.00M     0   250
  /dev/dm-0  laptop lvm2 a-   55.69G 32.00M   250  1499
  /dev/dm-0  laptop lvm2 a-   55.69G 32.00M  1749    32
  /dev/dm-0  laptop lvm2 a-   55.69G 32.00M  1781     1

OK, let me show you. I created an LV with:
lvcreate --name testlv0 --size 100m --mirror 1 testvg

lvs -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Devices
testlv0 testvg mwi-a- 100.00M testlv0_mlog 100.00 testlv0_mimage_0(0),testlv0_mimage_1(0)

Any other suggestion for a -o option? I tried stripes, segtype, seg_start, seg_size, seg_tags, regionsize, mirror_log and lvs --segments.

I can't find an option for pvs that prints the allocation map, nor for vgs. Any suggestions?

Lupe Christoph

Signature · 2 lines
| There is no substitute for bad design except worse design.                   |
| /me                                                                          |
#3 lore raw
Quoted 3 lines · Lupe Christoph

I can't find an option for pvs that prints the allocation map, nor for vgs. Any suggestions?

Try
lvs VG -a --segments -o +devices
that should print all the information you need.

Regards,
Jaroslav Stava

#4 lore raw
Quoted 7 lines · Jaroslav Stava
Quoted 2 lines · Lupe Christoph

I can't find an option for pvs that prints the allocation map, nor for vgs. Any suggestions?

Try
lvs VG -a --segments -o +devices
that should print all the information you need.

<hug>Jaroslav, you're right!</hug>

Actually, I don't need segment information, so I can omit --segment. The command that gives me what I can use is

lvs testvg --separator : --noheadings --all -o +devices

The "-a" or "--all" option is the key. Thanks a lot for this! Now that I know what to look for, I find it in lvs --help. But not in the manpages. Guess where I looked :-(

Lupe Christoph

Signature · 2 lines
| There is no substitute for bad design except worse design.                   |
| /me                                                                          |