- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script for LV creation from old vg to new VG
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
тАО09-15-2010 12:34 PM
тАО09-15-2010 12:34 PM
Please let me know if we have any script for creating LVs
I am doing the migration from one VG to another . I have stuck @ lvcreation . I need the same LV's to be created with same name and size on the new VG's.
while creating the new LV the script should take the info/parameter from the old VG's like size and name of the LV and create the same in the new VG.
I have tried some scripts but no luck. BTW, its huge migrations like we have around 50 VG with 5000 Vols of 20TB storage .
Really it will be helpful if somebody can help me out in this situation .
please let me know if you need more info .
Thank you
Kumar
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2010 01:43 PM
тАО09-15-2010 01:43 PM
Re: Script for LV creation from old vg to new VG
> I have tried some scripts but no luck.
- could you tell us what you tried that didnot work.
- 50 VG with 5000 Lvol is good enough to keep you busy.
- Basically you have to capture the LV size , and names with awk to prepare the script for same vg_name , lv_name and size for new storage.
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2010 01:46 PM
тАО09-15-2010 01:46 PM
Re: Script for LV creation from old vg to new VG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2010 02:03 PM
тАО09-15-2010 02:03 PM
Re: Script for LV creation from old vg to new VG
You can try for i in loop too with awk .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2010 04:51 AM
тАО09-16-2010 04:51 AM
Re: Script for LV creation from old vg to new VG
It would help to see the command you are using and the error message.
You should be able to pull vgdisplay and lvdipslay info from the old volume group and feed it into an vgcreate and lvcreate statement to build the volume groups on the new VG.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2010 06:35 AM
тАО09-16-2010 06:35 AM
Re: Script for LV creation from old vg to new VG
New VG = vg_new_prod
for ((i=1;i<=48;i++))
do
echo " lvcreate -L 'vgdisplay -v /dev/vgprod$i |egrep -i "LV Size" |awk '{print $4}'' -I 64 -i 4 -r N -A n -n ' vgdisplay -v /dev/vgprod$i |egrep -i "LV Name" |awk '{print $3}' |tr '/' ' ' |awk '{print $3}'' /dev/vg_new_prod$i "
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2010 09:58 AM
тАО09-16-2010 09:58 AM
Re: Script for LV creation from old vg to new VG
Vg migration.....
is it like from old storage to new one??
if yes
if you have 11.31 with march 2010 patch
You can do #vgmove
#vgmove is the good method tested and working fine.
chandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2010 12:28 PM
тАО09-16-2010 12:28 PM
Re: Script for LV creation from old vg to new VG
Here you go,
You can check with a small example , and can implement this script to generate the lvcreate commands:
#########################################
#gen_lvcreate :v1.0:
for ((i=1;i<=48;i++))
do
echo "Processing for VG= vgprod$i ..."
vgdisplay -v vgprod$i | grep -i -e "LV Name" -e "LV Size" | cut -c 32- | awk 'ORS=NR%2?FS:RS' | tr "/" " " | awk '{print "lvcreate -L "$4 " -I 64 -i 4 -r N -A n -n " $3 " /dev/vgprod$i" }' >> lvcreate_cmds_vgprod$i
echo "$i :: lvcreate command generation done: for Vg=vgprod$i :------------------------------------ \n\n"
done
#Checking generated files:
ls -l lvcreate_cmds*
echo "Done"
#########################################
One Example:
#---------------
$
vgdisplay -v vg08 | grep -i -e "LV Name" -e "LV Size" | cut -c 32- | awk 'ORS=NR%2?FS:RS' | tr "/" " " | awk '{print "lvcreate -L "$4 " -I 64 -i 4 -r N -A n -n " $3 " /dev/vg08" }'
lvcreate -L 139968 -I 64 -i 4 -r N -A n -n lvol1 /dev/vg08
lvcreate -L 139968 -I 64 -i 4 -r N -A n -n lvol2 /dev/vg08
lvcreate -L 139968 -I 64 -i 4 -r N -A n -n lvol3 /dev/vg08
lvcreate -L 139968 -I 64 -i 4 -r N -A n -n lvol4 /dev/vg08
lvcreate -L 139968 -I 64 -i 4 -r N -A n -n lvol5 /dev/vg08
lvcreate -L 139968 -I 64 -i 4 -r N -A n -n lvol6 /dev/vg08
lvcreate -L 139968 -I 64 -i 4 -r N -A n -n lvol7 /dev/vg08
lvcreate -L 0 -I 64 -i 4 -r N -A n -n lvol8 /dev/vg08
$
#######################################################################
Cheers,
Enjoy, Have Fun!,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2010 12:56 PM
тАО09-16-2010 12:56 PM
SolutionCorrection:
-(new vgname missed in the earlier post):
- variable inserted inside awk.
#########################################
#gen_lvcreate :v1.1:
for ((i=1;i<=48;i++))
do
echo "Processing for VG= vgprod$i ..."
NEW_VG_NAME=vg_new_prod$i
vgdisplay -v vgprod$i | grep -i -e "LV Name" -e "LV Size" | cut -c 32- | awk 'ORS=NR%2?FS:RS' | tr "/" " " | awk -v VG=$NEW_VG_NAME '{print "lvcreate -L "$4 " -I 64 -i 4 -r N -A n -n " $3 " /dev/" VG }' > lvcreate_cmds_vg_new_prod$i
echo "$i :: lvcreate command generation done: for Vg=vg_new_prod$i :------------------------------------ \n\n"
done
#Checking generated files:
ls -l lvcreate_cmds*
echo "Done"
#########################################
cheers,
Raj.
** Remember to assign points to all the posts, once resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2010 07:18 PM
тАО09-16-2010 07:18 PM
Re: Script for LV creation from old vg to new VG
thank u
Kumar