- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: best practice to check VG state
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
тАО03-12-2010 07:28 AM
тАО03-12-2010 07:28 AM
What is the best practice to check the state of a volume group? I mean to check in what state it is in? (exclusive/active rw/active ro/inactive)
I need this for an automated script. Until now I did a vgdisplay to that VG and looked for the exit status. Is there any specific command to do this?
Regards,
Viktor
Unix operates with beer.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2010 07:35 AM
тАО03-12-2010 07:35 AM
Re: best practice to check VG state
Depending upon your objective, I'd do:
# vgdisplay -v vg_name
(or on 11.31)
# vgdisplay -vF vg_name
...and parse out the fields you want to examine.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2010 07:41 AM
тАО03-12-2010 07:41 AM
Re: best practice to check VG state
I would in addition to vgdisplay options recommend this:
vgcfgbackup
It there is a problem, it will fail with a non-zero error code.
Great way to find trouble before it gets out of control.
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
тАО03-12-2010 08:44 AM
тАО03-12-2010 08:44 AM
Re: best practice to check VG state
>...and parse out the fields you want to examine.
Yepp, but what if the vg isn't activated? I want to have a solution also in case it is disabled. Any better method than checking the output of vgdisplay?
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2010 08:52 AM
тАО03-12-2010 08:52 AM
Re: best practice to check VG state
Yepp, but what if the vg isn't activated?
Then you would not have any (STDOUT) output. The absence of which would be an indication that the state wasn't what you wanted.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2010 09:01 AM
тАО03-12-2010 09:01 AM
Re: best practice to check VG state
# vgdisplay vg03
vgdisplay: Volume group not activated.
vgdisplay: Cannot display volume group "vg03".
You wold have to make allowances for this in your script. If a VG is not activated you are not going to be able to get much information from it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2010 09:14 AM
тАО03-12-2010 09:14 AM
Re: best practice to check VG state
#!/usr/bin/sh
for VG in $(ls ├в 1d /dev/vg*)
do
vgdisplay ${VG} 2>&1 | grep ├в q "not activated"
VGRETCD=$?
if [[ "${VGRETCD}" ├в eq 0 ]] ; then
echo "${VG} is not active. No further information is available"
echo ""
else
echo "${VG} Information:"
vgdisplay ${VG} |grep ├в e Access ├в e Status
echo ""
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2010 09:18 AM
тАО03-12-2010 09:18 AM
SolutionHere's the correct script without the garbage characters.
#!/usr/bin/sh
for VG in $(ls -1d /dev/vg*)
do
vgdisplay ${VG} 2>&1 | grep -q "not activated"
VGRETCD=$?
if [[ "${VGRETCD}" -eq 0 ]] ; then
echo "${VG} is not active. No further information is available"
echo ""
else
echo "${VG} Information:"
vgdisplay ${VG} |grep -e Access -e Status
echo ""
fi
done
Here's output from the script:
# sh ./test1.sh
/dev/vg00 Information:
VG Write Access read/write
VG Status available
/dev/vg02 is not active. No further information is available
/dev/vg03 is not active. No further information is available
/dev/vg04 Information:
VG Write Access read/write
VG Status available, exclusive
/dev/vg05 Information:
VG Write Access read/write
VG Status available
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2010 02:27 PM
тАО03-13-2010 02:27 PM
Re: best practice to check VG state
Unix operates with beer.