Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a VG with VPaths in a script

Status
Not open for further replies.

visvid

Technical User
Jun 3, 2002
131
GB
Logical Volume Filesystems size vapth vpath
xxxxxxxf00 xx/xx_u000 2G 0 26
xxxxxxxf01 xx/xx_u001 14G 1 27
xxxxxxxf02 xx/xx_u002 14G 2 28
xxxxxxxf03 xx/xx_u003 14G 3 29
xxxxxxxf04 xx/xx_u004 14G 4 30
xxxxxxxf05 xx/xx_u005 14G 5 31
xxxxxxxf06 xx/xx_u006 14G 6 32
xxxxxxxf07 xx/xx_u007 14G 7 33


I have been tasked with creating several new VG’s and was looking to see if there was an easier way of doing through a script

The Lv’s are the same except the end prefix running from f00 to f52 and FS ending in _u000 to U052 using 2 vpaths in separated data centres

File sizes with be different to ranging from 128 mb to 14G , to do the crfs I was going to create a flat flie and run it as a script.

Does any one know of a good way or could help with a script to do this. I have several new VG’s I need to create and I am looking at a way of saving time


The spread shhet looks out of line but vapths are 0 & 26 , 1 &27 etc

On the 7th day God created Super Moto
:)
 

For example, create a script which has 3 input parameters: vparh name, lv/fs name and size.

Then store the information triplets in a flat file and you can use xargs to run you script as many times as needed.

cat myparams.txt | xargs -n 3 my_createvg_script.sh

Need help on scripting?

--Trifo
 
trifo


Yes is the answer I am very new to script writing and so far i have built this nodes manually , so any ideas would be appreciated, if you are good with scripts can you look at my expr on cron question :)

On the 7th day God created Super Moto
:)
 
Well, here follows a wery simple approach, with no error handling. It takes 3 input parameters:
- vpath name
- namebase for VG and LV
(put "my_new" to get my_new_vg containing my_new_lv)
- mount point for the filesystem creadted

consider, that vg name must not exceed 15 characters!

Code:
#!/usr/bin/ksh

VPATHNAME=$1
NAMEBASE=$2
MOUNTPOINT=$3

VGNAME=${NAMEBASE}_vg
LVNAME=${NAMEBASE}_lv

# create vpath based VG
# for big VG-s you might need to set bigger PP size ( -s 64 )
mkvg4vp -y $VGNAME $VPATHNAME

# collect total number of PP-s out of lsvg output
PPNUM=`lsvg vale_vg | head -3 | tail -1 | tr -s " " | cut -d " " -f 6`

# decrease number by 1 (reserve place for loglv)
let PPNUM=PPNUM-1

#create LV
# for bigger LV-s you might need to set max_pp (-x option)
mklv -y $LVNAME $VGNAME $PPNUM

#create FS
# for big fs you might need to set nbpi, AG, fragment sizes to fit your needs
# consider fs options, like jfs or jfs2, large file enabled, or whatsoever.
crfs -v jfs -m $MOUNTPOINT -d $LVNAME -A yes

You will have to customize it to your specific environement!Good luck!

--Trifo
 
Tri

many thanks i will try this on one of the dev boxes first many thanks

On the 7th day God created Super Moto
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top