Operating System - HP-UX
1753765 Members
6123 Online
108799 Solutions
New Discussion юеВ

Re: Script for VG's and LV's and FS creations.

 
Mike_305
Super Advisor

Script for VG's and LV's and FS creations.

Hello All,

Thanks to all in advance.

I know how to create VG's, LV's, and FS from command like but I am looking for a script the dose that. Does anyone one has that out there that will be super and save me some typing and it will be easy to create VG's and LV's when you have 50+ luns.

I have the comma line in place but having difficulty putting in script format. Appreciate your help.

> pvcreate /dev/rdsk/cxtxd0
> mkdir XYZ
> find out the next GROUP #
> mknod /dev/vgxx/group c 64 0x010000
> vgcreate -e XX -p XX -s XX /dev/vgXX "Disk path"
> lvcreate -L XGB -n lvol1 VGname
> newfs -F vxfs -o largefiles dev/vgXX/rlvolX

Thanks to all in advance.
If there is problem then don't think as problem, think as opportunity.
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: Script for VG's and LV's and FS creations.

Hi:

To a large extent you have the guts of your script as outlined. It's just a matter of defining and using variables, as for example:

# vgcrete -e ${MAXPE} -p ${MAXPV} -s ${PESIZE} /dev/vg${VGNBR} ${PVPATH}

For the 'mknod' major numbers, remember that the values are in hexadecimal. Hence a volume group with a major number of "0x100000" is decimal sixteen (16). An easy way to convert your decimal values to hexadecimal ones is to use 'printf':

# printf "%02x\n" 16
10

If you are running 11.23 or less, remember that your kernel's maxvgs' parameter sets the ceiling for the largest major number for volume groups, so you may need to adjust this first before you run your script. Too, a 'maxvgs' value of <10> [decimal] is zero-relative, so with vg00 only, one slot is taken.

Regards!

...JRF...
Mike_305
Super Advisor

Re: Script for VG's and LV's and FS creations.

Hello James,

Thanks for the quick reply. I do have the idea about some "for do loops" but having trouble putting all this together.

For example I do "FOR LOOP" like this.

I have all this BITS and pices and now I need to put it together with some intelligence. Way too many FOR LOOPS...

LOL

If someone has one already out their then will defiantly save me some time.

Appreciate your help.

=====================================
> for hw in $(ioscan -fun -C disk | grep -i emc | awk '{print $3}')
do
ioscan -fun -H ${hw} | grep dsk | awk '{print $1}'
done | sort > Disk.list

> set -A disks $(cat disk.list)

> for disk in ${disks[*]}
do
pvcreate /dev/rdsk/${disk##*/}
done
===================================

Thanks in advance...
If there is problem then don't think as problem, think as opportunity.
Mike_305
Super Advisor

Re: Script for VG's and LV's and FS creations.

Hello,

When I do this and it takes the first disk only. Not all the disk in working file. Any idea why?

for disk in ${disks[*]}
do
vgcreate /dev/vgXX /dev/dsk/${disk##*/}
done

Thanks for the help in advance.
If there is problem then don't think as problem, think as opportunity.
Dennis Handly
Acclaimed Contributor

Re: Script for VG's and LV's and FS creations.

>When I do this and it takes the first disk only. Not all the disk in working file.

You have: Disk.list
Then: set -A disks $(cat disk.list)

You should also toss that evil cat:
set -A disks $(< Disk.list)
Check with: echo ${disks[*]}
Mike_305
Super Advisor

Re: Script for VG's and LV's and FS creations.

Thanks for your help.
If there is problem then don't think as problem, think as opportunity.