1837461 Members
4017 Online
110117 Solutions
New Discussion

lvm headers

 
SOLVED
Go to solution
p7
Frequent Advisor

lvm headers

hi all

i have some disks i have to use for a new volume group (xp1024 seen by 4 systems). it is only seen on this system with xpinfo, not showing up on the other 3 systems. when i try do do a pvcreate it says part of a volume group. must have been used in the past, is there a command that shows the lvm header? i want to be paranoid and check

thx in advance
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: lvm headers

Hi:

One way is:

# cat ./querylvmid
#!/usr/bin/sh
typeset RAWDEV=${1}

[ -z "${RAWDEV}" -o ! -c "${RAWDEV}" ] && { echo "Not a raw device"; exit 1; }

KIND=$(xd -An -j 8192 -N8 -tc ${RAWDEV} 2> /dev/null | xargs)

if [ "${KIND}" = "L V M R E C 0 1" ]; then
INFO=$(xd -An -j8200 -N16 -tx ${RAWDEV})
PVID=$(echo ${INFO} | awk '{print $1 $2}')
VGID=$(echo ${INFO} | awk '{print $3 $4}')
echo "${RAWDEV} PVID = ${PVID}"
echo "${RAWDEV} VGID = ${VGID}"
else
echo "${RAWDEV} is not an LVM disk"
fi
exit 0

...To query, pass a raw device argument like:

# ./querylvmid /dev/rdsk/c1t1d0

Regards!

...JRF...
p7
Frequent Advisor

Re: lvm headers

thx

is there a way to get the volume group name?
James R. Ferguson
Acclaimed Contributor

Re: lvm headers

Hi (again):

> is there a way to get the volume group name?

A volume group name is established by the device file (e.g. '/dev/rdsk/vg01). In fact, 'vgexport'ing a volume group and then 'vgimport'ing it with a *different* device file name is how you rename a volume group. Hence, the answer to your question is "no".

Regards!

...JRF...