- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script to collect info from ll /dev/*/group
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-10-2010 10:53 PM
тАО09-10-2010 10:53 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2010 04:42 AM
тАО09-11-2010 04:42 AM
Re: script to collect info from ll /dev/*/group
Your objective isn't clear. For volume group creation (prior to recent version of 11,31 where the vg_name directory and its 'group' file are created automatically) you would do (for version-1 LVM) :
# mkdir /dev/vgXX
# mknod /dev/vgXX/group c 64 0xNN0000
After this step a 'vgcreate' would be done. It's the subsequent creation of logical volumes with 'lvcreate' that generate the block and raw (character) device files beneath '/dev/vgXX'.
Hence, you don't need a script in the fashion of your question. Again, your objective isn't clear.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2010 07:08 AM
тАО09-11-2010 07:08 AM
SolutionUpon reflection, I think this thread relates directly to this one:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1447193
...and that we are dealing with pre-11.31 systems using LVM version 1.0 where it is necessary to manually make the 'group' directory prior to a 'vgimport'. In this context, I assume that you want to 'vgexport' volume groups from one server; and 'vgimport' then on another. Two scripts (below) should help. Run the first script; copy the '/tmp/*.map' files and the '/tmp/VGINFO' file to the target server; and execute the second script there.
# cat ./pass1
#!/usr/bin/sh
set -u
VGINFO=/tmp/VGINFO
rm -f ${VGINFO}
VGS=$(vgdisplay|awk '/VG Name/ {print $3}')
for VG in ${VGS}
do
MYMAP="/tmp/$(basename ${VG}).map"
echo vgexport -v -p -s -m ${MYMAP} ${VG}
MINOR=$(ls -l ${VG}/group | awk '{print $6}')
echo "${VG} ${MINOR} ${MYMAP}" >> ${VGINFO}
done
exit 0
# cat ./pass2
#!/usr/bin/sh
set -u
VGINFO=/tmp/VGINFO
while read VG MINOR MYMAP X
do
echo mkdir ${VG}
echo mknod ${VG}/group c 64 ${MINOR}
echo vgimport -v -s -m ${MYMAP} ${VG}
done < ${VGINFO}
exit 0
...REMOVE the 'echo' when you are satisfied with the behavior. Running the scripts with it shows this (on a test server of mine):
# ./pass1
vgexport -v -p -s -m /tmp/vg00.map /dev/vg00
vgexport -v -p -s -m /tmp/vg01.map /dev/vg01
# cat /tmp/VGINFO
/dev/vg00 0x000000 /tmp/vg00.map
/dev/vg01 0x010000 /tmp/vg01.map
# ./pass2
mkdir /dev/vg00
mknod /dev/vg00/group c 64 0x000000
vgimport -v -s -m /tmp/vg00.map /dev/vg00
mkdir /dev/vg01
mknod /dev/vg01/group c 64 0x010000
vgimport -v -s -m /tmp/vg01.map /dev/vg01
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2010 07:08 AM
тАО09-11-2010 07:08 AM
Re: script to collect info from ll /dev/*/group
Thanks for the reply. Yes you are correct to say that you do not need it for HP-UX 11.31, and it would only apply for HP-UX 11i and below. This script would be used on HP-UX 11.00 to create the directories before the vgimport.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2010 07:20 AM
тАО09-11-2010 07:20 AM
Re: script to collect info from ll /dev/*/group
Yes it is exactly what I wanted.This will make things easier. Thanks will be assigning points.
Thanks once again.
Warm Regards
Jose da Silva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2010 11:08 AM
тАО09-11-2010 11:08 AM
Re: script to collect info from ll /dev/*/group
You probably want to skip exporting vg00 after all, so the first script could look like:
# cat ./pass1
#!/usr/bin/sh
set -u
VGINFO=/tmp/VGINFO
rm -f ${VGINFO}
VGS=$(vgdisplay|awk '/VG Name/ {print $3}')
for VG in ${VGS}
do
[ "${VG}" = "/dev/vg00" ] && continue
MYMAP="/tmp/$(basename ${VG}).map"
echo vgexport -v -p -s -m ${MYMAP} ${VG}
MINOR=$(ls -l ${VG}/group | awk '{print $6}')
echo "${VG} ${MINOR} ${MYMAP}" >> ${VGINFO}
done
exit 0
...Remember that you can always skip the 'vgimport' for a volume group by removing its information from the '/tmp/VGINFO' created by './pass1' before running './pass2'.
You might also want to activate your volume groups after their import with 'vgchange'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2010 09:16 AM
тАО09-12-2010 09:16 AM
Re: script to collect info from ll /dev/*/group
Thanks for the last update, yes I do not want to export vg00. Will use your last recomendation.
Warm Regards,
Jose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2010 11:54 AM
тАО09-12-2010 11:54 AM
Re: script to collect info from ll /dev/*/group
From the first question I understand you are looking for some script ,that will help recreating /dev/vg and group files from the existing data captured with ll /dev/*/group :
Check this out:
#example : suppose you want to generate the commands for vg01 and vg02 for recreation.
# This is useful for storage migration etc:
# You mkdir and mknod commands will be ready for one shot execution:
ls -lrt /dev/*/group | grep -e vg01 -e vg02 | awk '{print "mkdir " $10 }' | sed 's/\/group//'
ls -lrt /dev/*/group | grep -e vg01 -e vg02 | awk '{print "mknod " $10 "\t" " c 64 " $6 }'
Enjoy, Have fun!,
Raj.