Operating System - HP-UX
1833696 Members
3360 Online
110062 Solutions
New Discussion

Determing minor nos in use for major no:64(lvm)

 
amit mehta_2
Regular Advisor

Determing minor nos in use for major no:64(lvm)

Hi,

Is their any full proof method of determining the available minor no LVM.
I'm using the following method:
root@hpia7// $ minor_avail=`ls -la /dev/vg*/group | awk '{print $6}'`
root@hpia7// $ echo $minor_avail
0x000000 <===
root@hpia7// $ lsdev|grep lvm
64 64 lv lvm

but this doesn't always work :(
sometimes after crating the vg and due to some reason if the user could not create the LVs and removed the PVs from LVM control by directly dd ing it with zeroes in the private region of the disk and then brought them under control of another volume manager(VxVM) and removed the entry of previously created VG ()by rm -rf /dev/.then next time while creating the vg using mknod with the same minor no which was provided while was created doesn't work and it complains that this minor no is already in use.
hence i need to have a better method of determining which all minor nos for major no:64 are in use .

Thanks,
~amit
6 REPLIES 6
Torsten.
Acclaimed Contributor

Re: Determing minor nos in use for major no:64(lvm)

If the "user" deletes VG's that way - hit him!

The information about this VG is still on different places on your system - you will see some additional problems too.

The only good method is to use vgreduce.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Steven E. Protter
Exalted Contributor

Re: Determing minor nos in use for major no:64(lvm)

Shalom amit,

Creating and removing logical volumes and disk devices and volume groups is complex, and I would never trust it to a user. This is a systems administration function.

You may wish to add a little diagnostics to your script to look at the $? variable after the attempt to create the device and see what the error code is.

Very often there are stray device files left around from sysadmin's learning their trade or users learning how to do this.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
amit mehta_2
Regular Advisor

Re: Determing minor nos in use for major no:64(lvm)

Thanks Torsten and Steven,

Just now i tweaked a little with vgreduce and
i am fully convienced with what Torsten said,
Also as all these (pvcreate,vgcreate,lvcreate,vgreduce,etc) are in /usr/sbin directory hence i would expect the su to be using these than the cheap dd method.


Thanks again,
~amit
Patrick Wallek
Honored Contributor

Re: Determing minor nos in use for major no:64(lvm)

If you need to get rid of a VG very quickly you can also use 'vgexport'.

# vgexport

will completely blow away the old VG.
Patrick Wallek
Honored Contributor

Re: Determing minor nos in use for major no:64(lvm)

P.S. Any "administrator" that is creating VGs and LVs but does not know how to properly remove them needs to (re)education, one way or another......

James R. Ferguson
Acclaimed Contributor

Re: Determing minor nos in use for major no:64(lvm)

Hi:

You need also to be aware that all of the LVM commands reside in '/sbin' too. This is for use in single-user mode when only the root filesystem is mounted.

I second Patrick's remarks. You need to use the LVM toolset to manage LVM disks. I suggest you read chapter-6 in "Managing Systems and Workgroups: A Guide for HP-UX System Administrators":

http://www.docs.hp.com/en/B2355-90950/index.html

Regards!

...JRF...