- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Finding out the VGID for a volumegroup (CLI of...
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
03-25-2004 10:20 AM
03-25-2004 10:20 AM
Finding out the VGID for a volumegroup (CLI of C program)
If not CLI, will any small C code work?
Jeff Schussele provided a good solution (below)in another thread, but probably since adb wont be available, I can't use it on all the systems.
Hi,
I think what you're looking for is the VGID for that volume group.
If so here's a method
----------------------------------------
echo 0x2010?2X|adb /dev/dsk/cXtYdZ|expand|tr -d " "
This should yield a result like
2010: 778B50B1 3D5D3888
If you drop the 2010: & combine the next two fields - there's your VGID
778B50B13D5D3888
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2004 10:30 AM
03-25-2004 10:30 AM
Re: Finding out the VGID for a volumegroup (CLI of C program)
1) echo "0x2008?4D" | adb /dev/dsk/CXtYdZ" | awk '{print $NF}'
Last field is the VGID
2)you can also use vgexport
# vgexport -p -s -m /tmp/vg02.map /dev/vg02.map 1>/dev/null 2>&1
# head -1 /tmp/vg02.map | awk '{print $2}'
It will give you 16 hex digits. The first 8 digits are the CPU ID of the system the vg was initally created. the next 8 digits are your VGID for the VG.
Sundar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 02:41 PM
03-26-2004 02:41 PM
Re: Finding out the VGID for a volumegroup (CLI of C program)
It definitely works under HP-UX 11i.
Col
//------------------------------------------------------------//
// Description: //
// //
// Quick bit of C code to extract the LVMREC from an LVM disk //
// //
//------------------------------------------------------------//
#include
#include
#include
main(int argc, char* argv[])
{
//-----------------------------------------------------------------------//
// Define the structure (as it doesn't appear in a header file anywhere) //
//-----------------------------------------------------------------------//
struct pvraHdr
{
char magic[8];
long long pvid;
long long vgid;
} *pvp;
//----------------------//
// Set up the variables //
//----------------------//
char buf[1024];
char magic[9];
int fd;
//-------------------------//
// Try and open the device //
//-------------------------//
if (( fd = open(argv[1],O_RDONLY)) == -1 )
{
perror("Open failed");
exit(1);
}
//----------------------------------------//
// Set the file pointer to an 8192 offset //
// and read data into buffer. //
//----------------------------------------//
lseek(fd,8192,SEEK_SET);
read(fd,buf,sizeof(buf));
//-------------------------------//
// Map the data to the structure //
//-------------------------------//
pvp=(struct pvraHdr*)buf;
strncpy(magic,pvp->magic,8);
magic[8]='\0';
//---------------------------//
// Print out what we get.... //
//---------------------------//
if (! strcmp(magic,"LVMREC01"))
{
printf("%s %s %#llx %#llx\n",argv[1],magic,pvp->pvid,pvp->vgid);
}
else
{
printf("%s doesn't look like an LVM disk\n");
exit(2);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 04:16 PM
03-26-2004 04:16 PM
Re: Finding out the VGID for a volumegroup (CLI of C program)
#vgexport -p -s -m /tmp/vgxxx.map /dev/vgxxx
It will create vgxxx.map file. View it and you will find the vgid at the very first line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2004 08:10 AM
10-22-2004 08:10 AM
Re: Finding out the VGID for a volumegroup (CLI of C program)
And here is a version of the code that will
compile under the bundled non-ANSI cc
compiler....