Operating System - HP-UX
1825221 Members
4429 Online
109679 Solutions
New Discussion юеВ

How to remove a physical volume group from a vg?

 
JI HUI
Frequent Advisor

How to remove a physical volume group from a vg?

Hi,

Currently, one disk was failed in our system (HP-UX). It was part of vg04 which consists of to PVG. PVG1 and PVG2 and each PVG1 consist of 4 physical volume.

When I tried to to make_recovery -AvC, error was reported and could not continue. The new disk will not come so soon. So, I believe I could continue with make_recovery if I either remove its physical volume (the /dev/dsk/c1t12/d0) or the PVG it belongs to.

Please advise:
Should I remove just the pv or the whoe PVG?
Please kindly advise step by step procedure.

Thank you.
Nothing is everything
3 REPLIES 3
steven Burgess_2
Honored Contributor

Re: How to remove a physical volume group from a vg?

Hi

Removing a physical volume from a volume group is failry straight forward

vgreduce /dev/vg0# /dev/dsk/c#t#d#

However , I am not entirely certain when removing the volume whilst it is part of a PVG -

Have looked at man vgreduce -

Before executing vgreduce, remove all logical volumes residing on each physical volume represented by a pv_path by executing lvremove (see lvremove(1M)). Any physical volume in the pv_path list that is also a member of a physical volume group (as defined in /etc/lvmpvg) is also removed from the physical volume group. If the physical volume happens to be the last one in the physical volume group, the physical volume group is also removed from the volume group.
When a physical volume in the pv_path list has multiple PV-links, the physical volume is not removed from the volume group, until all the links to the volume are removed. When a physical volume in the pv_path list is the primary link (in use) to a physical volume, removing the link forces LVM to switch to the alternate link to access the physical volume. When the pv_path removed is an alternate link to the device, only the link is removed; the volume group and physical volume are otherwise unchanged.


Regards

Steve
take your time and think things through
Thayanidhi
Honored Contributor

Re: How to remove a physical volume group from a vg?

Hi,

Before you remove the PV from VG, make sure all the lv's on the pv are un used.

i.e. you should either lvremove (non-mirrored), or lvreduce (if mirrored). then vgreduce the pv from the vg.(Take care of the data inside)

If you try to vgreduce when there are used portions of the disk, it gives error.

Once you vgreduce the PVG file is updated automatically.

You can verify manual in /etc/lvmpvg file.

No need to remove (un configure) entire PVG!

--TT

Attitude (not aptitude) determines altitude.
PIYUSH D. PATEL
Honored Contributor

Re: How to remove a physical volume group from a vg?

Hi,

You can remove the mirror copy by lvextend or you can remove the logical volume which used to exist on the disk by using lvremove.

# lvreduce -m 0 -k /dev/vg04/lvol4 /dev/dsk/c1t12d0

-k option will remove the defective disk from your vg

If there is no mirroring then use

# lvremove /dev/vg04/lvol4

Then you can remove the physical volume from the volume group.

#vgreduce /dev/vg04 /dev/rdsk/c1t12d0

If this doesn't work then you can do the following:

#mv /etc/lvmpvg /etc/lvmpvg.old

# vgscan

Then try backing up.

HTH,
Piyush