Operating System - HP-UX
1753488 Members
4619 Online
108794 Solutions
New Discussion

Finding free disk to use with pvcreate

 
Jerry M
Occasional Contributor

Finding free disk to use with pvcreate

When I try to use pvcreate on some disks I want to use, I get:

 

 #pvcreate /dev/rdsk/c2t1d1
pvcreate: The physical volume already belongs to a volume group

I was told to not use pvcreate -f  in case it is being used by another server. How can I really tell if it's being used

by another server for data.  The disk in not in the /etc/lvmtab of any VG also.

 

 

 

11 REPLIES 11
Jeff_Traigle
Honored Contributor

Re: Finding free disk to use with pvcreate

The VG name can be determined with pvdisplay:

 

pvdisplay /dev/dsk/c2t1d1

 

If you want to additionall see what extentss are allocated to which LVs, you can use the -v option:

 

pvdisplay -v /dev/dsk/c2t1d1

--
Jeff Traigle
Steven E. Protter
Exalted Contributor

Re: Finding free disk to use with pvcreate

Shalom,

 

:smileysurprised:

 

If the disk is already part of a volume group:

 

vgdisplay -v vg_name

 

pvdisplay -v is a good idea before using pvcreate -f

 

The advice not to use -f which stands for force is very good advice.

 

You may need to post the output to see if any logical volumes are current.

 

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jerry M
Occasional Contributor

Re: Finding free disk to use with pvcreate

Don't forget in my post:    The disk in not in the /etc/lvmtab of any VG also.

 

I had our sr. admin here show me how to look at the EMC, etc... , was not easy, and look at what is being used by what host.

 

 

Jerry M
Occasional Contributor

Re: Finding free disk to use with pvcreate

All the disks are free. Does anyone know how to make the really free so when someone does a pvcreate in the

future it will not bark about it being in use?

 

Hello Steven, it's been a while since I was on. Good to see you are still around on the forums.

Karol_84
Occasional Advisor

Re: Finding free disk to use with pvcreate

If those LUNs were used under LVM, then pvremove on character device should make the header clean.

Karol
jerrym
Trusted Contributor

Re: Finding free disk to use with pvcreate

pvremove does not clear disk. I know for sure c2t1d5 is not being used anywhere. Any other ideas.

 

 

 #pvremove  /dev/rdsk/c2t1d5
pvremove: The physical volume "/dev/rdsk/c2t1d5" belongs to an exported volume group.
pvremove: Couldn't remove physical volume "/dev/rdsk/c2t1d5".

Pete Randall
Outstanding Contributor

Re: Finding free disk to use with pvcreate

I believe you need to use vgreduce -f once you know which vg it originally belonged to.  The fact that it says the vg is exported makes me wonder if you have to import it first.  Sounds potentially messy but it might be the only way.


Pete
Karol_84
Occasional Advisor

Re: Finding free disk to use with pvcreate

If you're sure the PV doesn't belong to VG, then do: # pvcreate -f /dev/rdsk/c2t1d5 # pvremove /dev/rdsk/c2t1d5 ... this should cleanup the header and next time when assigning this LUN to VG it won't be necessary to use force option.
Karol
jerrym
Trusted Contributor

Re: Finding free disk to use with pvcreate

Karol, pvcreate -f and pvremove works. Thanks