VGIDs and PVIDs on HP-UX

Both VGIDs and PVIDs on HP-UX are a combination of two values: the CPU ID of the machine on which the VG or PV is created and the Unix timestamp at the time of creation.

VGIDs from VGs

To view the VGID of a VG, use vgexport with the “scanable” flag to create a map file for the VG. Inside the map file will be the VGID as one, big hex number:

Note: The man page vgexport(1M) calls the -s flag the “sharable” option. In my opinion, this is a confusing misnomer. I call it the “scanable” flag because all it does is put the VGID line at the top of the map file allowing vgimport to scan all of the PVs in order to determine which PVs belong to that VG. Without that VGID line in the map file and the “scanable” flag in vgimport, you must specify each PV manually. Obviously, being able to scan for all of the PVs in a VG during importation is nice when a VG can move between multiple machines, but it’s just as handy if the VG never leaves the machine on which it was created.

# vgexport -p -v -s -m vg170.map vg170
Beginning the export process on Volume Group "vg170".
vgexport: Volume group "vg170" is still active.
/dev/dsk/c15t5d7
/dev/dsk/c15t7d6
/dev/dsk/c15t7d7
/dev/dsk/c15t8d1
/dev/dsk/c16t0d4
/dev/dsk/c16t0d5
/dev/dsk/c16t0d6
/dev/dsk/c19t5d2
/dev/dsk/c19t5d3
/dev/dsk/c23t7d4
/dev/dsk/c24t7d4
/dev/dsk/c24t7d5
/dev/dsk/c24t7d6

# cat vg170.map
VGID 075354214cf400f2
1 depot

The first 8 characters are the CPU ID and the last 8 are the timestamp. To check the CPU ID just convert from hex to decimal. The CPU ID of a machine can be obtained with uname -i.

# echo "0X07535421=D" | adb
                122901537

# uname -i
122901537

As we can see here, this VG was created on this computer.

Seeing the creation date is very similar.

# echo "0X4cf400f2=Y" | adb
                2010 Nov 29 13:37:22

VGIDs and PVIDs from disk headers

The headers of each LVM-controlled disk contain both the VGID of the VG the disk belongs to, as well as a unique PVID. There are a few ways to format the VGID, depending on what you are trying to do.

To get the VGID off of a disk in hex (maybe to compare with a VG map file):

# echo 0d8208?XX | adb /dev/dsk/c19t5d3
2010:           7535421         4CF400F2

To get the VGID off of a disk in decimal (maybe to compare CPU ID):

# echo 0d8208?UU | adb /dev/dsk/c19t5d3
2010:           122901537       1291059442

To get the date in human-readable format:

# echo 0d8208?UY | adb /dev/dsk/c19t5d3
2010:           122901537       2010 Nov 29 13:37:22

Viewing the PVID is very similar, we just have to look at a slightly different offset:

# echo "0d8200?UY" | adb /dev/dsk/c19t5d3
2008:           122901537       2010 Nov 29 13:53:31

Source

I got this information from the HP ITRC forums.

Advertisements

One Response to VGIDs and PVIDs on HP-UX

  1. Berges says:

    Hello,

    very nice trick, i am not sure mots of HP employees knew it

    it saves my work with hitachi true-copy for disaster recovery and you can use it only with the mapfiles in /etc/lvmconf and a vgscan

    thanks again

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: