Opened 13 years ago
Closed 13 years ago
#609 closed defect (fixed)
analyze-my-lvm doesn't work for more than "1" /dev/mapper/* lvm PV devices on RHEL6.2
Reported by: | bzium | Owned by: | Bruno Cornec |
---|---|---|---|
Priority: | normal | Milestone: | 3.0.2 |
Component: | mindi | Version: | 3.0.1 |
Severity: | major | Keywords: | |
Cc: |
Description
Function GiveMapperOfdm() in analyze-my-lvm doesn't work for more than "1" /dev/mapper/* lvm PV devices on RHEL6.2
/dev/mapper/(dev_name) is symbolic link to /dev/dm-X "stat" command in GiveMapperOfdm should be run with "-L" switch.
GiveMapperOfdm () { major=`stat -c "%t" $1 2> /dev/null` minor=`stat -c "%T" $1 2> /dev/null` for i in `ls /dev/mapper/*`; do mj=`stat -c "%t" $i` mn=`stat -c "%T" $i` if [ "$mj" = "$major" ] && [ "$mn" = "$minor" ]; then echo "$i" return fi done echo $1 }
should be
GiveMapperOfdm () { major=`stat -L -c "%t" $1 2> /dev/null` minor=`stat -L -c "%T" $1 2> /dev/null` for i in `ls /dev/mapper/*`; do mj=`stat -L -c "%t" $i` mn=`stat -L -c "%T" $i` if [ "$mj" = "$major" ] && [ "$mn" = "$minor" ]; then echo "$i" return fi done echo $1 }
Attachments (2)
Change History (6)
comment:1 by , 13 years ago
Milestone: | → 3.0.2 |
---|---|
Status: | new → assigned |
comment:2 by , 13 years ago
by , 13 years ago
Attachment: | givemappefdm.sh.gz added |
---|
by , 13 years ago
Attachment: | givemappefdm-new.sh.gz added |
---|
comment:3 by , 13 years ago
Please take givemappefdm.sh.gz from attachment and check two or more devices.
# ls -la /dev/mapper/mpath* lrwxrwxrwx 1 root root 7 Apr 18 10:34 /dev/mapper/mpatha -> ../dm-2 lrwxrwxrwx 1 root root 7 Apr 18 10:34 /dev/mapper/mpathb -> ../dm-3 lrwxrwxrwx 1 root root 8 Apr 19 10:27 /dev/mapper/mpathc -> ../dm-10 # ./givemappefdm.sh /dev/mapper/mpatha /dev/mapper/mpatha # ./givemappefdm.sh /dev/mapper/mpathb /dev/mapper/mpatha # ./givemappefdm.sh /dev/mapper/mpathc /dev/mapper/mpatha
Your function always display first device /dev/mapper/mpatha. After that try givemappefdm-new.sh.gz from attachments.
# ./givemappefdm-new.sh /dev/mapper/mpatha /dev/mapper/mpatha # ./givemappefdm-new.sh /dev/mapper/mpathb /dev/mapper/mpathb # ./givemappefdm-new.sh /dev/mapper/mpathc /dev/mapper/mpathc
If you do not add "-L" stat for each device will show:
# stat -c "%T" /dev/mapper/mpath* 0 0 0 [root@proddb1 mondo-test]# stat -c "%t" /dev/mapper/mpath* 0 0 0
All devices have a "major minor = 0 0". If you add "-L" switch stat show correct "major minor".
# stat -L -c "%T" /dev/mapper/mpath* 2 3 a # stat -L -c "%t" /dev/mapper/mpath* fd fd fd
Do you understand now what's the problem?
analyze-my-lvm always take first /dev/mapper/ device in this case show /dev/mapper/mpatha. /dev/mapper/mpatha is not a physical device for LVM
# pvs PV VG Fmt Attr PSize PFree /dev/mapper/mpathb vg_puedata lvm2 a-- 2.00g 104.00m /dev/mapper/mpathc vg_test lvm2 a-- 1020.00m 0 /dev/sda2 vg01 lvm2 a-- 17.80g 2.30g
# ./analyze-my-lvm /sbin/lvmdiskscan /sbin/lvm i=2 LVM version >= 2.0 found. Just before you extrapolate mountlist to include RAID partitions, extrapolate it to include the following LVM drives and partitions:- >>>>> /dev/mapper/mpatha /dev/mapper/mpatha /dev/sda2 To get started, type:- (insmod dm-mod) (insmod dm_mod) # lvm vgchange -an # echo y | lvm pvcreate -ff /dev/mapper/mpatha # echo y | lvm pvcreate -ff /dev/mapper/mpatha # echo y | lvm pvcreate -ff /dev/sda2 # lvm vgscan
And with "-L" switch.
# ./analyze-my-lvm /sbin/lvmdiskscan /sbin/lvm i=2 LVM version >= 2.0 found. Just before you extrapolate mountlist to include RAID partitions, extrapolate it to include the following LVM drives and partitions:- >>>>> /dev/mapper/mpathc /dev/mapper/mpathb /dev/sda2 To get started, type:- (insmod dm-mod) (insmod dm_mod) # lvm vgchange -an # echo y | lvm pvcreate -ff /dev/mapper/mpathc # echo y | lvm pvcreate -ff /dev/mapper/mpathb # echo y | lvm pvcreate -ff /dev/sda2 # lvm vgscan
comment:4 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Many thanks for your explanations, that showed I completely missed the point :-(.
Now fixed in rev [3001]. Will be in mindi 2.1.2.
I'm not sure I understand your problem. stat doesn't use -L as we need to have all the links, and the role of GiveMapperOfdm is to just give the /dev/mapper/ device correspondance to the /dev/dm-* one.
So while I'm not disagreeing that there may be an issue with multiple PVs, I'd like to get the /var/log/mondoarchive.log to have a better understanding of the issue, and see how to best fix it. For the moment, I think your fix risks to create more issues elsewhere.
TIA, Bruno.