- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: VG Script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 03:08 AM
тАО12-11-2009 03:08 AM
VG Script
#!/usr/bin/ksh
#
# 7/5/2007 JML
#
#This script reads the filesystem.txt file and collects all the
#required paramters to create volumegroup and filesystems
#
# VG label to indicate Volume group settings
# FS Lable to indicate Filesystem settings
TABLE=filesystem.txt
LOGS=/tmp/create-vg-lv.$$.log
if [ ! -r $TABLE ]
then
echo "File table does not exist, please check and re-run the script .... "
exit 9
fi
READ_VG()
{
ALLVG=`awk -F: '/^VG/ {print $2}' $TABLE`
echo "The following Volume groups will be created : \n${ALLVG} \n "
}
READ_FS()
{
ALLVG=`awk -F: '/^VG/ {print $2}' $TABLE`
for VGP in `echo $ALLVG`
do
echo "Checking $VGP filesystem requirements"
FSP=`awk -F: -v volgrp=$VGP '/^FS/ && $2 ~ volgrp {printf "%-4s %-21s %8dMB \n", $2,$3,($4/1024)}' $TABLE`
echo "$FSP"
done
}
READ_VG
READ_FS
read go?"Proceed to create the filesystmes (y/n): "
case $go in
Y|y|YES|yes )
echo "----------------------------------------------------" | tee -a $LOGS
echo "Creating directory and file for volume groups " | tee -a $LOGS
for vgc in `awk -F: '/^VG/ {print $2}' $TABLE`
do
#### Check if the VG directory exist ####
if [ ! -d /dev/${vgc} ] ; then
echo "$vgc does not exist, creating directory now "
minornum=`grep "VG:${vgc} | awk -F: '{print $NF}'`
set -x
mkdir /dev/${vgc}
mknod /dev/${vgc}/group c 64 0x0${minornum}0000
set +x
PRIDSK=`awk -F: -v volgrp=$vgc '/^VG/ && $2 ~ volgrp {print $3}' $TABLE`
ALTDSK=`awk -F: -v volgrp=$vgc '/^VG/ && $2 ~ volgrp {print $4}' $TABLE`
NUMPRIDK=`echo $PRIDSK | awk -F"," '{print NF}'`
#### Collecting disk information per VG ####
if [ $NUMPRIDK -gt 1 ] ; then
ADDPDSK=`awk -F: -v volgrp=$vgc '/^VG/ && $2 ~ volgrp {print $3}' $TABLE | \
awk -F"," '{print substr($0,index($0,$2))}'`
ALLDISKS=`echo "$ADDPDSK,$ALTDSK"`
FIRSRDSK=`awk -F: -v volgrp=$vgc '/^VG/ && $2 ~ volgrp {print $3}' $TABLE | \
awk -F"," '{print $1}'`
else
FIRSRDSK=$PRIDSK
ALLDISKS=$ALTDSK
fi
FIRSRDSK=`echo $FIRSRDSK | sed -e 's/,/ /g' | sed -e "s/c/\/dev\/dsk\/c/g"`
ALLDISKS=`echo $ALLDISKS | sed -e 's/,/ /g' | sed -e "s/c/\/dev\/dsk\/c/g"`
echo "$FIRSRDSK ----> $ALLDISKS"
##### Creating and Extending Volume Group ######
set -x
vgcreate -l 255 -e 7000 -p 32 -s 4 /dev/${vgc} $FIRSRDSK
vgextend /dev/${vgc} $ALLDISKS
set +x
###### Creating Logical Volumes using table file configuration #####
echo "Now we will create the Logical Volumes for $vgc .... \n"
# set -x
for lvolc in `awk -F: -v volgrp=$vgc '/^FS/ && $2 ~ volgrp {print $5}' $TABLE`
do
echo $lvolc
lv_mount=`awk -F: -v volgrp=$vgc -v lv=${lvolc} '/^FS/ && $2 ~ volgrp && $5 ~ lv {print $3}' $TABLE | head -1`
lv_size=`awk -F: -v volgrp=$vgc -v lv=${lvolc} '/^FS/ && $2 ~ volgrp && $5 ~ lv {print ($4/1024)}' $TABLE | head -1`
set -x
lvcreate -L $lv_size -n $lvolc $vgc "
mkfs -F vxfs -o ninode=unlimited,bsize=1024,version=5,inosize=256,logsize=16384,largefiles /dev/${vgc}/${lvolc}
mkdir -p $lv_mount
mount /dev/${vgc}/${lvolc} $lv_mount
set +x
echo "----------------------------------------------------"
done
set +x
else
echo "$vgc directory exist, please check and re-run $vgc only"
fi
done | tee -a $LOGS
;;
N|n|NO|no )
echo " Exiting script....... good bye..... "
exit 1
;;
* ) echo " Wrong option re-run the script and choose the right option... "
;;
esac
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 03:23 AM
тАО12-11-2009 03:23 AM
Re: VG Script
and how does it look like
If this is not the correct one... can someone give me a script to create multiple VG's and LV's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 03:47 AM
тАО12-11-2009 03:47 AM
Re: VG Script
I would be very careful with a script found on the net, especially if I don't know what it does and expects in detail.
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 04:07 AM
тАО12-11-2009 04:07 AM
Re: VG Script
COuld you give me a script to create multiple VG's
also my other hpvm issue is going hard... I have reinstalled the OS and everything but still the same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 04:43 AM
тАО12-11-2009 04:43 AM
Re: VG Script
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 05:13 AM
тАО12-11-2009 05:13 AM
Re: VG Script
# uname -a
HP-UX rx26-161 B.11.31 U ia64 3206393905 unlimited-user license
[rx26-161]/
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 05:13 AM
тАО12-11-2009 05:13 AM
Re: VG Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 05:17 AM
тАО12-11-2009 05:17 AM
Re: VG Script
;-)
But yes, you can.
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2009 06:17 AM
тАО12-11-2009 06:17 AM
Re: VG Script
> and how does it look like
I guess, this everyone is asking who is confronted with this script.
It really would have been nice by the script's author if he had dropped a comment line what the contents of the filesystem.txt file is supposed to be and what format it should have.
As he didn't, the user will have to "reverse engineer" by looking at the various awk statements that refer to $TABLE spread over several functions.
> If this is not the correct one...
> can someone give me a script to create multiple VG's and LV's
What would be the "correct" script for your task?
I think it would be easier to write you own script or disclose your requirements to the forum's community and hope to get a few hints how to tackle the task.
I think it is no great loss if you dismiss this script.
It doesn't look that convincing to me.
(e.g. many useless uses of echo etc.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2009 04:19 AM
тАО12-12-2009 04:19 AM