1752662 Members
5676 Online
108788 Solutions
New Discussion юеВ

LVM Filter Help!

 
SOLVED
Go to solution
Alzhy
Honored Contributor

LVM Filter Help!

What should be my filter so LVM only scans/deals with all mapper devices's p1 (partition 1) AND partition2's of sda and sdb?

I have the following but there are still duplicate PVs reported:

filter = [ "a/mapper/", "a|/dev/sda2$|", "a|/dev/sdb2$|", "r/.*/" ]

And boot times are excruciatingly long.

Our servers have a local RAIDED SCSIS sda and sdb as primary and 2ndary LVM based boot disks (partiion 1 bein g.boot and partition 2 - sda2/sdb2 as the PV for vg00 and vgbroot). Our storage SAN are a mix of HP EVA and XP12K and all are multipathed.

TIA!
Hakuna Matata.
7 REPLIES 7
FLQ
Valued Contributor

Re: LVM Filter Help!

Hi Alzhy,

By default LVM2
filter regexes have an implicit ".*" at beginning/end so in your first "add" filter, it would check for everything under / and append "mapper" to it.

If you use "/dev/mapper" instead, that might solve your problem.

Cheers
Matti_Kurkela
Honored Contributor
Solution

Re: LVM Filter Help!

Are /dev/sda and /dev/sdb parts of a RAID 1 set?

In that case, you should be accessing them through the RAID subsystem, whatever form it takes - not directly as /dev/sda* or /dev/sdb*.

I guess you have a software RAID of some sort. Are you using "dmraid" in Linux? What does "dmraid -r" listing look like in that system in that case?

Or are you using /dev/md* devices (Linux native software RAID)? In that case, what is the output of "cat /proc/mdstat"?

I have one system that has Intel AHCI-based software/BIOS RAID.

# dmraid -r
/dev/sdb: isw, "isw_djffgiiahe", GROUP, ok, 625142446 sectors, data@ 0
/dev/sda: isw, "isw_djffgiiahe", GROUP, ok, 625142446 sectors, data@ 0

# ll /dev/mapper/
total 0
crw-rw---- 1 root root 10, 59 2010-08-01 10:47 control
brw-rw---- 1 root disk 254, 0 2010-08-01 10:47 isw_djffgiiahe_SysVol
brw-rw---- 1 root disk 254, 1 2010-08-01 10:47 isw_djffgiiahe_SysVol1
brw-rw---- 1 root disk 254, 2 2010-08-01 10:47 isw_djffgiiahe_SysVol2
brw-rw---- 1 root disk 254, 4 2010-08-02 07:51 isw_djffgiiahe_SysVol5
brw-rw---- 1 root disk 254, 5 2010-08-01 10:47 isw_djffgiiahe_SysVol6
brw-rw---- 1 root disk 254, 3 2010-08-01 10:47 vg00-lvol0
brw-rw---- 1 root disk 254, 6 2010-08-01 10:47 vg00-lvol1
brw-rw---- 1 root disk 254, 7 2010-08-01 10:47 vg00-lvol2
brw-rw---- 1 root disk 254, 8 2010-08-01 10:47 vg00-lvol3
brw-rw---- 1 root disk 254, 9 2010-08-01 10:47 vg00-lvol4
brw-rw---- 1 root disk 254, 10 2010-08-01 10:47 vg00-lvol5

("isw" is dmraid's identifier for Intel Software RAID. "djffgiiahe" is the RAID set identifier, which may change if one of the disks fails and the RAID set must be rebuilt to another disk. "SysVol" is the name given to the RAID set when setting it up.)

If this system had SAN disks attached, I would set up a LVM filter like this:

filter = [ "a|^/dev/mapper/isw|", "a|^/dev/mapper/mpath|", "r/.*/" ]

MK
MK
Alzhy
Honored Contributor

Re: LVM Filter Help!

sda and sdb are HW raided (the box's Internal SAS RAID Controller).

All the rest are HPDM device multipathed disks.

My OS Disks sda (vg00) and sdb (vgbroot) are LVM sliced on partition 2 (dba2 and sdb2).

So what will my filter be?

Hakuna Matata.
Matti_Kurkela
Honored Contributor

Re: LVM Filter Help!

If you use "friendly names" for multipath devices (i.e. /dev/mapper/mpath0 and the like), then this filter should be correct for you:

filter = [ "a|^/dev/sda|", "a|^/dev/sdb|, "a|^/dev/mapper/mpath|", "r/.*/" ]

If you use WWIDs or custom names, you may have to modify the "/dev/mapper/mpath" part respectively.

Make sure all the other filter expressions in /etc/lvm/lvm.conf are commented out.

After changing the filter, delete the LVM cache file /etc/lvm/cache/.cache and run vgscan (using verbose mode so you can verify all the correct devices are scanned):

rm /etc/lvm/cache/.cache
vgscan -vv

MK
MK
Alzhy
Honored Contributor

Re: LVM Filter Help!

Matti -- thanks so far sir.

filter = [ "a|^/dev/sda|", "a|^/dev/sdb|, "a|^/dev/mapper/mpath|", "r/.*/" ]


Wth the above filter though -- will that also scan devices like /dev/sdab, /dev/sdby, etc..?

And How can I tell tehe filter to scan for PVs only on slice p1 on the mapper / friendly named multipaths?

The "a/mapper/" filter BTW is from an HP document for LVM and Storageworks. We have lots of disks on our servers -- so It would be kool if we can tell LVM to scan only for p1's -- we partition our disks - whole disk size on p1 to be "compliant" with best practice of partitioning disks -- even if the whole disk space is to be used for LVM.

TIA.
Hakuna Matata.
Matti_Kurkela
Honored Contributor

Re: LVM Filter Help!

> Wth the above filter though -- will that also scan devices like /dev/sdab, /dev/sdby, etc..?

Yes, you're correct. Let me try again.

> And How can I tell tehe filter to scan for PVs only on slice p1 on the mapper / friendly named multipaths?


So you have a huge number of disks?

Okay...

filter = [ "a|^/dev/sda[0-9]|", "a|^/dev/sdb[0-9]|, "a|^/dev/mapper/mpath.*p1$|", "r/.*/" ]

The filter syntax uses Regular Expressions (regexps). These are used by many other tools, like grep, sed and perl for example. Learning the basics of regular expressions might be very useful for you.

Here's a very quick Regexp 101:

The regexp syntax works a bit differently from wildcards:

. = any single character
* = the previous character or sub-expression repeated any number of times (including 0 times)
? = the previous character or sub-expression repeated 1 or more times

so there's a common construction:

.* = any number of any characters

[0-9] = any ASCII character between 0 and 9, inclusive.
[^0-9] = any character except numbers.

By default, the regexp pattern has implicit ".*" at its beginning and end. To override that, you use the anchor characters:

^ at the beginning of the search pattern = the target must contain nothing before this

$ at the end of the search pattern = the target must contain nothing after this.

These should be enough for you to figure out how the filter pattern I wrote (above) works.

MK
MK
Alzhy
Honored Contributor

Re: LVM Filter Help!

This worked:

filter = [ "a/mapper/.*p1$/", "a|/dev/sda[0-9]|", "a|/dev/sdb[0-9]|", "r/.*/" ]


This did not:

filter = [ "a|^/dev/sda[0-9]|", "a|^/dev/sdb[0-9]|, "a|^/dev/mapper/mpath.*p1$|", "r/.*/" ]
Hakuna Matata.