1834208 Members
2459 Online
110066 Solutions
New Discussion

LVM trouble....HELP!!!!

 
SOLVED
Go to solution
Steve Ferrara
Advisor

LVM trouble....HELP!!!!

Hi guys...junior admin here with an LVM question.

I needed to create some new filesystems and was given new EMC disk to do so. I fould my disk, did my pvcreate, made the VG, vgextended, lvcreated, lvextended, made the directory and mounted. My supervisor didn't like the VG name I chose, so I unmounted, lvremoved and vgexported. ( I know I didn't ahve to wipe everything out to change the name but I wanted the practice).

Anyway, now I'm starting from scratch, except when I try to do my pvcreate again with the new disk I get the following:

"pvcreate: The physical volume already belongs to a volume group"

How could this be if I vgexported? So I ignore and tried to create my VG anyway with that disk but it says its already used.

What gives? Thanks in advance
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: LVM trouble....HELP!!!!

No big deal just use the -f flag for pvcreate to force the reuse of the PV BUT make sure that this is the correct PV or you will wipe out the LVM data structures on a (possibly) active volume group disk. Pvcreate simply detected that the LVM data structures were already present. You could simply create a new /dev/vgxx directoru and a suitable /dev/vgxx/group device node and then vgimport since the vgexport does not alter data on the disks themselves.
If it ain't broke, I can fix that.
Uday_S_Ankolekar
Honored Contributor

Re: LVM trouble....HELP!!!!

use pvcreate with -f. Make sure you are using right disk!

-USA..
Good Luck..
Steve Ferrara
Advisor

Re: LVM trouble....HELP!!!!

Excellent thanks...its working!
Michael Tully
Honored Contributor

Re: LVM trouble....HELP!!!!

If you intend to re-use the volume, use 'vgreduce' to remove all vut the last LUN and then 'vgremove' to remove the volume group. Using 'vgexport' assumes your going to use the volume group again, either on the same system or on another. (That's the theory anyway)
As suggested by Clay, you can use the -f to force the re-use of it. Not a good practise, but one to be mindful of. There is the possibility of flattening your LUN by using the -f option on an incorrect LUN on your system.
Anyone for a Mutiny ?
Steve Ferrara
Advisor

Re: LVM trouble....HELP!!!!

One more question...

Before I did my pvcreate with a force, I tried to continue and create the VG despite the error message. I issued the mknod command and created the group. How do you remove the group? Do I just rm -r /dev/vg01?

The vg01 is the VG I previously exported.
A. Clay Stephenson
Acclaimed Contributor

Re: LVM trouble....HELP!!!!

Yes, at that point with no associated volume group this directory and its underlying group device node are nothing special. Simply rm them BUT if vg01 is in /etc/lvmtab then you need to do a bit more. Do a strings /etc/lvmtab and see if your vg01 is listed along with your disk. In that case, do a vgexport /dev/vg01. That will remove the entries in /etc/lvmtab and also remove /dev/vg01 and any files beneath it without destroying the LVM data structures on the vg01 disks themselves so that you can vgimport under a new VG.
If it ain't broke, I can fix that.
Steve Ferrara
Advisor

Re: LVM trouble....HELP!!!!

thanks...I did vgexport the vg01 so it was not in /etc/lvmtab. I just finished creating a filesystem so I'm back in business.

Thank you very much!