1753765 Members
5986 Online
108799 Solutions
New Discussion юеВ

Deleting a volume group

 
SOLVED
Go to solution
rewt
Occasional Contributor

Deleting a volume group

I was trying to get rid of a volume group on my system and I did it completely wrong I think. I did a vgexport /dev/vgXX...I didn't use the -m to export the configuration information. When I attempt to do a pvcreate it still says that the physical disk is part of that volume group. How do I completely disassociate that volume group from the physical disk so that I can do a pvcreate? Or is there any easier way around this? I basically just want to reformat this disk and recreate the same volume group on the same disk because the superblock was corrupted.
Thanks.
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor
Solution

Re: Deleting a volume group

Hi:

Try:

# pvcreate -f /dev/rdsk/cXtXdX

just make sure you have the right disk!

...JRF...
Byron Myers
Trusted Contributor

Re: Deleting a volume group

Rewt,
DO a "pvcreate -f
This will force the pvcreate. If you vgreduce a disk out of a VG, then you don't need the "-f" option of pvcreate, but using a vgexport to "delete" the volume group will require the "-f" option of pvcreate.
If you can focus your eyes far and straight enough ahead of yourself, you can see the back of your head.
Andreas Voss
Honored Contributor

Re: Deleting a volume group

Hi,

if the pvcreate -f ... does not work i do this hack to desytoy lvm informations on the disk:
prealloc /var/tmp/scratch 2000000
dd if=/var/tmp/scratch of=/dev/rdsk/c?t?d0 bs=64k
rm /var/tmp/scratch
Watch out for the correct devive else you have the risk of destroying other data.

Regards
John Palmer
Honored Contributor

Re: Deleting a volume group

Hi,

There's nothing wrong with using vgexport to remove a volume group from the system - it's the quickest way to do it. The only issue is that the disks still know that they are part of a VG (which might be vgimported into a system) and warn you when you attempt to pvcreate them.

As the others have stated, the -f flag to pvcreate overrides the objection.

Regards,
John
rewt
Occasional Contributor

Re: Deleting a volume group

That worked...thanks!
Bryan Dees
Occasional Contributor

Re: Deleting a volume group

I think mediainit /dev/rdsk/c#t#d# would
work as well.
Tim Nelson
Honored Contributor

Re: Deleting a volume group

One last note. I think you could avoided all of this by using the vgremove command ??