Tuesday, March 10, 2015

Number of Open LV and Current LV is different for VG

On one of our systems I see that the current number of logical volumes in vg00 does not equal the number of logical volumes currently open. The host does not seem to have any unusual problems because of this.

There are 16 pairs of files in the /dev/vg00 directory, which matches the 16 "open" LVs. However, there are 18 reported as "Cur LV". 

Unfortunately, due to additions/deletions the minor numbers are all over the map ranging from 0x000001 to 0x00001c.

I had hoped to avoid the brute-force approach-- but it worked,  to give me a nice list of all the LVs, sorted in minor number order, I used

ls -l /dev/vg00 | sort +5

Then I used a manual list of missing minor numbers to build a script to create all the devices:

foreach minor in 09 0c 10 11 12 14 15 16 17 18 19 1b; do echo mknod /dev/vg00/mia_${minor} b 64 0x0000${minor}; echo mknod /dev/vg00/rmia_${minor} c 64 0x0000${minor}; done > /tmp/make-minors.sh 

Then I just ran "sh /tmp/make-minors.sh" (after verifying that it looked good)

Now "pvdisplay -v" shows me which LVs were missing but still allocated. Now for a little judicious use of "lvremove"...

Thanks for the help.

PS: Here's what I saw that was odd: [Note the Cur LV vs. Open LV]

# vgdisplay vg00
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 18
Open LV 16
Max PV 16
Cur PV 2
Act PV 2
Max PE per PV 2500
VGDA 4
PE Size (Mbytes) 4
Total PE 4338
Alloc PE 3964
Free PE 374
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

PPS: It was "19" and "1b" that had been removed without removing their allocated logical extents.