1825049 Members
3234 Online
109678 Solutions
New Discussion юеВ

pvremove problem

 
SOLVED
Go to solution
BrianDoyle
Trusted Contributor

pvremove problem

Hi,

I wish to remove a LUN.
I received the following error:

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

ll /dev/vg*/group correctly contains 0x150000 Jul 7 15:59 /dev/vgx/group

Any advice appreciated to send me in the right direction.
Thanks
7 REPLIES 7
saju_2
Respected Contributor

Re: pvremove problem

Hi

man pvremove says

The pvremove command clears the LVM data structure on a disk, so that
it is no longer an LVM physical volume. The device may then be used
by the file system or by other Volume Manager.

The operation is denied if device file (/dev/rdsk/c6t3d0) is assigned to a volume group. The
pvremove command only clears the LVM data structure on a disk if the
disk does not belong to a volume group. This avoids accidentally
removing a valid physical volume under a volume group. If the
physical volume to be removed belongs to a volume group, use the
vgremove command to first remove the volume group associated with the
physical volume.
Sandy Chen
Honored Contributor

Re: pvremove problem

Hi,

If you wish to remove the LUN with pvremove, ensure that the disk doesn't belong to any VG. Use vgremove or vgexport to the VG.

regards,
Sandy
I never think of the future. It comes soon enough.
Mridul Shrivastava
Honored Contributor

Re: pvremove problem

Yes you have to remove that PV from the vg configuration only pvremove will work....

one way is to do vgreduce on that pv and another is to export vg but only if that vg is not in use any more.
Time has a wonderful way of weeding out the trivial
Mancboy
Valued Contributor

Re: pvremove problem

Try pvdisplay on the PV
it will tell you what vg it is attached to.

Also try a pvdisplay -v no the PV, that will tell you if there are any LVs still on the PV.

If there are any LVs on it:
1) check that the LV isn't in mirrored mode (lvdisplay will tell you how many "Mirrored copies" there are, if it is then lvreduce the mirror on this PV.
2) if there are any further extents on this PV, then pvmove the LV from this PV to another PV in the VG.

If it is attached to any VG, vgreduce the PV from the VG

Then you should be able pvremove the disc, without too much trouble.

BrianDoyle
Trusted Contributor

Re: pvremove problem

Thanks for all your replies.
I should have added that i had tried the following:

# vgcreate -s 16 vgx /dev/dsk/c6t3d0
Increased the number of physical extents per physical volume to 6399.
vgcreate: Volume group "/dev/vgx" could not be created:
The path does not specify a valid physical volume.
#

# vgexport -v /dev/vgx
Beginning the export process on Volume Group "/dev/vgx".
vgexport: Volume group "/dev/vgx" does not exist in the "/etc/lvmtab" file.
vgexport: Couldn't export volume group "/dev/vgx".
-> ROOT-dublin@nllsp101:/
#

# vgreduce /dev/vgx /dev/dsk/c6t3d0
vgreduce: Volume group "/dev/vgx" does not exist in the "/etc/lvmtab" file.
-> ROOT-dublin@nllsp101:/

The 100GB LUN is new and is empty so no data can be lost.
There are no mirrors or extents.

Feel like I might have no option than to do a forced removal (which i dont like) unless anyone can think of another option....
Mancboy
Valued Contributor
Solution

Re: pvremove problem

try a vgscan -p -v it will tell you if there are any LVM structures on the disc - the -p bit says don't actually change anything on the system

NB make sure you make a safe copy the /etc/lvmtab file first.

If the output from vgscan doesn't give any new information, try a vgimport -v on the PV to see if it can reimport the PV and recreate the LVs - then you can try and delete the LVs
BrianDoyle
Trusted Contributor

Re: pvremove problem

I made a copy of my lvmtab file and did a vgscan -p -v and this listed which PV's couldn't be matched to which VG's.

A vgimport -v vg_name worked and I activated it with vgchange -a y vg_name.
I can now continue working with it.

Many thanks for everybodys help(especially Mancboy.