Operating System - HP-UX
1832645 Members
2598 Online
110043 Solutions
New Discussion

Re: mknods with volume with another name besides vg0?

 
SOLVED
Go to solution
Donald C Nelson
Frequent Advisor

mknods with volume with another name besides vg0?

I have this script file that creates device nodes for volume groups:

for i in `cat $source_dir/vg_nums`
do
cd /dev
rm -r $i
mkdir $i
mknod /dev/$i/group c 64 0x`grep $i $source_dir/vg_nums|cut -c 3-4`0000
echo
done

vg_nums contains the following: vg02 vg03 vg04.

But, if vg_nums contains EMC or something other than vg01-09, how would I use a script file to create the major number for these volume groups. I am using this as part of a DR recreation..
5 REPLIES 5
Patrick Wallek
Honored Contributor
Solution

Re: mknods with volume with another name besides vg0?

I would do have a file with the vg name and the minor number as separate fields.

# cat vgnames
vg01 0x010000
vg02 0x020000
vgemc 0x030000

And then do the script like

while read VGNAME MINOR
do
cd /dev
rm -rf ${VGNAME}
mkdir ${VGNAME}
mknod /dev/${VGNAME}/group c 64 ${MINOR}
ll /dev/${VGNAME}/group
echo ""
done

This way it will work no matter what your VG names are.
Patrick Wallek
Honored Contributor

Re: mknods with volume with another name besides vg0?

I forgot a part of my script.

The very last line of the script should be:

done < vgnames

so that it can read in the vgnames file.
Florian Heigl (new acc)
Honored Contributor

Re: mknods with volume with another name besides vg0?

/dev/vg10 would be 0x0a0000 so You will have to push grep $i $source_dir/vg_nums|cut -c 3-4 through a hex calculator.
Usually it's called ox, but I didn't find it on hp-ux, so either You include a function for the conversion (better), or You have to ensure it's made available on every system.
yesterday I stood at the edge. Today I'm one step ahead.
Florian Heigl (new acc)
Honored Contributor

Re: mknods with volume with another name besides vg0?

Uh, Patricks way is a lot easier and more reasonable, especially when I think of our SAP-boxes, where the volumegroup names are not numerical at all :)
yesterday I stood at the edge. Today I'm one step ahead.
Donald C Nelson
Frequent Advisor

Re: mknods with volume with another name besides vg0?

Thanks Patrick, your method will work for me.