- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script for Exporting and Importing VG's
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
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
тАО06-01-2003 12:21 PM
тАО06-01-2003 12:21 PM
I was wondering if anyone out there has a script for creating a VGImport and Export script. I have some preliminary work done already but I cannot get some of it to work. So, if you have any information for me it would greatly be appreciated.
Thanks in advance,
CoMteC17
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2003 05:29 PM
тАО06-01-2003 05:29 PM
Re: Script for Exporting and Importing VG's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2003 06:16 PM
тАО06-01-2003 06:16 PM
Re: Script for Exporting and Importing VG's
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf0fc5dc05a7ad711abdc0090277a778c,00.html
http://www.shellderado.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 05:12 AM
тАО06-02-2003 05:12 AM
Solutionfor i in `ls -d /dev/vg*`
do
vgexport -s -p -v -m /tmp/$i.map $i
done
Then to import, mkdir all the /dev/vg's
and
mknod /dev/vgXX/group c 64 0xXX000
for i in `ls /tmp/*.map | awk -F. '{print $1}' | awk -F/ '{print $3}'`
do
vgimport -s -v -m /tmp/$i.map /dev/$i
done
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 05:14 AM
тАО06-02-2003 05:14 AM
Re: Script for Exporting and Importing VG's
here is the export script:
#! /usr/bin/ksh
# this script written by John Meissner 4.14.2003
# This script will automatically do a vgexport for a server and generate map files
BOLD="`tput smso`"
NORMAL="`tput rmso`"
if [ `id|cut -c5-11` != "0(root)" ]
then
echo "Quitting - You must run this script as Root"
exit 1
fi
SGP=$(cmviewcl | grep `hostname` | grep enabled | awk '{print $1}') #checks for SG package name
# the following section will check for the service gard package status and halt the package
mcsg=1
while [ "$mcsg" = "1" ]
do
SGPS=$(cmviewcl | grep `hostname | grep enabled | awk '{print $2}') #checks the SG package status
if [ "$SGPS" = up ]
then
echo "Service Gard package $SGP is $SGPS - stopping package now"
cmhaltpkg $SGP
elif [ "$SGPS" = "down" ] || [ $? != 0 ]
then
echo "Service Gard package $SGP is $SGPS - continuing "
mcsg=0
elif [ "$SGPS" = "starting" ] || [ "$SGPS" = "halting" ]
then
echo " Service Gard package $SGP is $SGPS - sleeping 10 "
sleep 10
fi
done
#this section will find the VG names for the server and export the VG's to map files
dev_vg=$(ll /dev/vg*/group | grep -v vg00 | awk '{print $10}' | sed 's/\/group//g' | sed 's/\/dev\///g')
for i in $dev_vg
do
vgexport -p -s -m $dev_vg.map /dev/$dev_vg
done
#find the failover server and ftp the map files
SGF=$(cmviewcl -v -p $SGP | grep Alternate | awk '{print $4}')
ftp -n -i <
user username password
cd /tmp
ascii
mput /tmp/*.map
quit
HERE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 05:16 AM
тАО06-02-2003 05:16 AM
Re: Script for Exporting and Importing VG's
#! /usr/bin/ksh
# written by John Meissner on 4.14.03
# this script will automatically import vg map files created from other servers
# this entire process will deal only with the VG's that have new map files for them
# the map files will have already been ftp'd from the primary SG server to the /tmp directory
# get a list of the minor numbers and get them ready
vgmap_files=$(ls /tmp/*.map | sed 's/\/tmp\///g'| sed 's/\.map//g')
for i in $vgmap_files
do
ll /dev/vg*/group | grep $i | awk '{print $6,$10}' >> /tmp/minornum.list
newvg=$(ll /dev/vg*/group | grep $i)
if [ "$newvg" = "" ]
then
function get_next_volume_group_minor_number {
typeset -Z2 NEXTMINORNUM=0
let MINORNUM=0
ls -l /dev/*/group | awk '{print $6}' | cut -c 3-4 | {
while read MINORNUM
do
if ((NEXTMINORNUM < MINORNUM));
then
let NEXTMINORNUM=MINORNUM
fi
done
}
let NEXTMINORNUM=NEXTMINORNUM+1
print "0x0"$NEXTMINORNUM"0000 $i" >> /tmp/minornum.list
}
fi
done
# export the old VG's
oldvg-$(cat /tmp/minornum.list | awk '{print $2}' | awk -F/ '{print $3}')
for i in $oldvg
do
vgexport $i
done
fi
#now vgimport the new vg maps
vgdir=$(cat /tmp/minornum.list | awk '{print $2}' | awk -F/ '{print $3}')
for i in $vgdir
do
mkdir /dev/$i
done
#mknod
cat /tmp/minornum.list | awk '{print "mknod " $2 " c 64 " $1}' > /tmp/makenod.sh
chmod +x /tmp/makenod.sh
/tmp/makenod.sh
#vgimport
cat minornum.list | awk '{print "vgimport -s -m " $2 ".map /dev/" $2}' > /tmp/vgimpt.sh
chmod +x /tmp/vgimpt.sh
/tmp/vgimpt.sh
echo " you may now try to start the SG package "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2003 08:33 PM
тАО06-02-2003 08:33 PM
Re: Script for Exporting and Importing VG's
There was one command that did the trick for me. I will post the script when I have completely tested it.
I do have one question, how do force the export of the VG? What I mean is, after I run the vgexport -v -m /mapfile -s /dev/vg , I strings the /etc/lvmtab and the vg is still there.
Is there anything special I must do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 03:17 AM
тАО06-03-2003 03:17 AM
Re: Script for Exporting and Importing VG's
Thanks again for all the responses.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 03:37 AM
тАО06-03-2003 03:37 AM
Re: Script for Exporting and Importing VG's
comment out the following two lines:
function get_next_volume_group_minor_number {
}
(the last } bracket in the function for get_next_volume_group_minor_number will also need to be commented out.)
after you do that it should work perfectly. sorry for not catching this sooner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 04:20 AM
тАО06-03-2003 04:20 AM
Re: Script for Exporting and Importing VG's
vgexport
without any options this should remove the vg from you system and the lvmtab - but it sounds like you got that already
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 04:58 AM
тАО06-03-2003 04:58 AM