1837179 Members
2589 Online
110113 Solutions
New Discussion

Major and minor numbers

 
ROSS HANSON
Regular Advisor

Major and minor numbers

How do you get the Major and minor numbers of a volume group? (vg00, vg01, vg02...)
Ross Hanson
7 REPLIES 7
Sridhar Bhaskarla
Honored Contributor

Re: Major and minor numbers

Hi,

ll /dev/*/group will list all the group device files. A VG is pointed to by it's group file.

5 th field is the major number.
6 th field is the minor number
10th or last field contains the volume group.

Note that minor number is limited by the 'maxvgs' kernel parameter.

-Sri



You may be disappointed if you fail, but you are doomed if you don't try
Dave Hutton
Honored Contributor

Re: Major and minor numbers

Like Sri said, heres an example:
# ll /dev/vg*/group*
crw-r----- 1 root sys 64 0x000000 Sep 30 13:53 /dev/vg00/group
crw-r--r-- 1 root sys 64 0x030000 Oct 1 08:51 /dev/vg01/group

Dave
Patrick Wallek
Honored Contributor

Re: Major and minor numbers

The major number will always be the same, 64. The minor number is unique to each VGs group file.

When doing the mknod command as a part of creating a VG it is of the syntax:

# mknod /dev/vg%%/group c 64 0x0?0000

Where %% is the name of your VG, normally like VG01, VG02, etc and the ? is a unique HEXADECIMAL number for the minor number.

To see what minor numbers are currently in use do:

# ll /dev/vg*/group



A. Clay Stephenson
Acclaimed Contributor

Re: Major and minor numbers

Do an ls -l /dev/vgXX. The major device number is always 64. The minor device number
are 0xVG0001 for the first lvol, 0xVG0002 for the 2nd, ... . By convention VG for vg00 is 00, VG for vg01 is 01, VG for vg12 is 0c and so on but that is simply a convention. vg01 could easily use 0x060000 but life is a bit easier when you follow the rules. You do need to make absolutely certain than whatever you choose for the VG hex digits that they be unique on that system.
If it ain't broke, I can fix that.
Jeff Schussele
Honored Contributor

Re: Major and minor numbers

Hi Dave,

Sri's approach is better because you can't assume that all VG names start with "vg"

And the default out of the box maxvgs value is 10. So any VG minor number (assuming they've been assigned completely AND in order) larger than 0x090000 (they're in HEX - so for EX 0x0a0000) will not be allowed until maxvgs is bumped up & a new kernel rebooted.

Personally, I think this parm is a *prime* candidate for being dynamic.

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Dave Hutton
Honored Contributor

Re: Major and minor numbers

Ah true Jeff, I just happened to have a prompt sitting there and figured I would shoot out an example.

I do like A. Clay's suggestion. As you can see in my example I didn't do it that way. Even though I don't foresee ever having a whole lot of vg's on this server. (Never say never I guess)

Where I've seen this get ugly sometimes is with service guarded vg's.

Dave
Michael Tully
Honored Contributor

Re: Major and minor numbers

Just a further note to this:

You can use 'lsdev' to get all major numbers of drivers.

When creating a volume group after using:
# mkdir /dev/vgxx
# mknod /dev/vgxx/group c 64 0x020000

The 'vgcreate' command will check for a duplicate number prior to creating the volume group. If it finds one, the command fails.
We rarely use /dev/vgNN, but more likely to use names like /dev/psdata so the numbering convention is out the window.

(just my 2 cents worth)
Anyone for a Mutiny ?