- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script for VG and LV create
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
Forums
Discussions
Discussions
Discussions
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
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
10-22-2008 02:35 PM
10-22-2008 02:35 PM
I know how to do this from command line but does anyone has the scrip that I can modify and save time to create my VG's and LV's.
I have lots of file systems that I need to create.
Appreciate your help and thanks in advance.
THX
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2008 06:24 PM
10-22-2008 06:24 PM
Re: Script for VG and LV create
Rgds,
Johnson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2008 11:07 PM
10-22-2008 11:07 PM
Re: Script for VG and LV create
- maxvg kernel parameter;
- fing higher /dev/*/group number;
- check for duplicate VG name;
- create VG;
- create LV;
- mounpoints if necessary ...
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2008 11:11 PM
10-22-2008 11:11 PM
Re: Script for VG and LV create
- LVM ver 1.0, 2.0, 2.1
- OS version
- multipathing
- striping
- mirroring
- ...
It always depends on your needs ...
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
10-23-2008 03:26 AM
10-23-2008 03:26 AM
Re: Script for VG and LV create
I think you are new to HPUX. VG creation is not a regular OR day to day activity. And the parameters used to create VG and LV keeps on change depending on your DB, Apps etc..... as mentioned by Torsten. If you want to create lots LV and VG's with same parameters, please come up with details of your server and get more specific answer.
Rgds
Sreekanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 04:12 AM
10-23-2008 04:12 AM
Re: Script for VG and LV create
You need to think about the needs that you have and what variables you would like to specify.
The script is not tested, i don't have a HPUX machine at hand :-), so it is from memory, but it is something to build on.
#!/usr/bin/ksh
if [ $# -ne 1 ]
then
echo "USAGES: $0
fi
# c1d1t1
DISK=$1
print -n "type new vgname: "; read VGNAME
print -n "type new lvname: "; read LVNAME
print -n "type new lvsize: "; read LVSIZE
# standard names
# VGNUM=$(echo $VGNAME | awk -Fg '{print $2}'
# else
print -n "type the vgnumber (01 for vg01) : "; read VGNUM
pvcreate /dev/rdsk/${DISK}
mkdir /dev/${VGNAME}
mknod /dev/${VGNAME}/group -c 64 0x${VGNUM}000
vgcreate ${VGNAME} /dev/dsk/${DISK}
lvcreate -L ${LVSIZE} -n ${LVNAME} /dev/${VGNAME}
fsadm -F vxfs -o largefiles /dev/${VGNAME}/${LVNAME}
echo "rember to put this volume into fstab"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 09:23 AM
10-23-2008 09:23 AM
Re: Script for VG and LV create
Thanks for the reply; I am looking for suggestion related to Volume group creation and File system related steps to be put in scripts.
Appreciate your help.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 09:28 AM
10-23-2008 09:28 AM
Re: Script for VG and LV create
Do you need mirrored and/or striped LVOLs? How many disks per VG, how many alternate pathes. Do you have more alternates than supported? This would require additional checks! Do you run 11.31? In this case you don't need to check and create the group files. What maximum disk size you will have in future? How large do you want to have the PE size? Do you want to do any manual load balancing over several pathes? Do you have add. multipathing software?
Only a few questions out of many questions ...
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
10-23-2008 12:25 PM
10-23-2008 12:25 PM
Re: Script for VG and LV create
Running 11.23
Thanks for your help. I did not want get too complicated on this. I have script like this and it is bunch of â for loopsâ .
What I wanted is few idea on how can prompt the script so that I can enter VG name and minor numbers mknod command. If I can prompt then I don't have put that in script.
Also want to find out how prompt with "question" if you want to continue ot not, and if the answer is "NO" then exit 0, with running any commands.
I am doing mkdir and mknods manually.
Thanks in advance for your time and help.
===============================
set -A disk $(cat /tmp/disk)
sleep 2
for disk in ${disk[*]}
do
pvcreate /dev/rdsk/${disk##*/}
sleep 2
vgcreate -e 9600 -p 32 -s 32 /dev/$VG_NAME /dev/dsk/${disk##*/}
sleep 2
sleep 2
done
==============================
for X in 1 2 3
do
lvcreate -L $LV_SZ_lvol${X}_a -n lvol${X} /dev/$VG_NAME
sleep 5
done
===============================
for X in 1 2 3
do
newfs -F vxfs -o largefile /dev/$VG_NAME/rlvol${X}
sleep 10
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 01:00 PM
10-23-2008 01:00 PM
Solution> What I wanted is few idea on how can prompt the script so that I can enter VG name and minor numbers mknod command...
You could use something like this:
#!/usr/bin/sh
typeset VGNAME
typeset MINORNBR
typeset -l REPLY
while true
do
echo "Enter VG Name: \c"
read VGNAME
echo "Enter minor #: \c"
read MINORNBR
echo "The VG NAME will be '${VGNAME}'"
echo "The minor # will be '${MINORNBR}'"
echo "Continue y|n: \c"
read REPLY
[ "${REPLY}" = "y" ] && break || exit 0
done
echo "now continuing..."
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 09:50 AM
10-24-2008 09:50 AM
Re: Script for VG and LV create
After your suggestion, it was good but still trying to fix 2 things. I have worked around for the issue but since I am putting all these pieces in place, might as well do this one to.
Thanks for your help in advance
If anyone else has any suggestion please let me know.
Appreciate your help and time.
============================
Q-1 What is the best way to grad the next available MINOR NUMBER out of my mknod listing? I am running following.
ls -l /dev/*/group | awk '{printf "%s\n", $6}' | sort â n
==============================
Q-2 For my LVOL creations I have lvol sizes are in the scrips and that is working fine when I have following.
lvcreate -L $LVSZ_1 -n lvol1 /dev/$VG_NAME â (Manual Command works fine)
lvcreate -L $LVSZ_2 -n lvol2 /dev/$VG_NAME
LOOP is not grabbing my LVOL size that was set in variables.
for X in 1 2 3
do
lvcreate -L $LVSZ_${X} -n lvol${X} /dev/$VG_NAME
done
=================================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2008 11:31 AM
10-27-2008 11:31 AM