Remove LVM info

 
SAM_24
Frequent Advisor

Remove LVM info

Hi,

When I reinstall the OS still system remembers the old disk groups. How to remove the old info? Just running pvremove is enough?

Thanks
Never quit
10 REPLIES 10
Scott Van Kalken
Esteemed Contributor

Re: Remove LVM info

It depends.

I'd be tempted to do the lot.

if mirrored reduce logical volumes

remove logical volumes
remove volume groups
remove disks (if required).

Then again, the idea of an ignite is to rebuild a system that has crashed or to clone identical systems.

Scott.
Michael Tully
Honored Contributor

Re: Remove LVM info

The LVM information will remain on the disk headers of volume groups other than vg00.

You can just re-use the disks into new volume groups if you don't require the old information.

To re-use the new disks use 'pvcreate -f /dev/rdsk/cxtydz
Anyone for a Mutiny ?
Mike Hassell
Respected Contributor

Re: Remove LVM info

Raj,

As Michael has already stataed, the LVM info will remain on the disks even after you remove it from LVM.

The easiest way is to just reuse the disk with a pvcreate -f /dev/rdsk/cXtXdX, although if you really want to ensure that all data has been fully removed from the disk you can use dd:

dd if=/dev/zero of=/dev/dsk/cXtYdZ count=

I don't think /dev/zero is installed by default, but the major number is the same as /dev/null and the minor is 3, but I would check on that before creating the device if it is not already present.

The bottom line is that I wouldn't go to all the trouble of wiping the disks clean with dd, unless I had a reason to, otherwise a simple pvcreate will suffice.

Hope that helps.

-Mike
The network is the computer, yeah I stole it from Sun, so what?
Sean McConkey_2
Advisor

Re: Remove LVM info

If you do a pvcreate -f and the disk is already in lvmtab, you may get an error message;

pvcreate: The physical volume "/dev/dsk/c0t5d0" is already recorded in the "/etc
/lvmtab" file.

You will need to "vgexport" the associated volume group, as well as removing the logical volumes etc. as already suggested.

I also delete and re-create the /dev/vg?? special files for all non-root volume groups.

eg rm -r /dev/vg01

mkdir /dev/vg01
mknod /dev/vg01/group c 64 0x010000

However I question why you are doing this if you are using Ignite on the same box, it was created on? Normally only required on a DR box where device names are similar.

HTH

Sean
You did what with rm -r!!!!!
PIYUSH D. PATEL
Honored Contributor

Re: Remove LVM info

Hi,

pvcreate -f /dev/rdsk/c1t2d0

vgexport does not remove any information from the disks, it removes the info about the vg from the OS.

Piyush
Sean McConkey_2
Advisor

Re: Remove LVM info

Piyush,

It is necessary to remove the the information using vgexport from /etc/lvmtab before you can destroy the data on the disk with pvcreate.

This applies as already suggested if the physical volume already matches that stored in /etc/lvmtab. If it doesn't then pvcreate will work.

Disaster recovery is my game and I have to do this regularly when testing client systems.

You did what with rm -r!!!!!
Craig Rants
Honored Contributor

Re: Remove LVM info

One way to tell if you have an LVM record on a disk is:

echo "0x2000?4S" | adb /dev/dsk/cXtXdX

you should see something like

2000: LVMREC01adjfakdjfa;

If you you have a record on that disk.

HTH,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Robert Sipe
Occasional Advisor

Re: Remove LVM info

pvcreate -f
None
Frank Slootweg
Honored Contributor

Re: Remove LVM info

Because you say "remembers the old disk groups" (note "groups"), I assume that it still shows the old *volume* groups (i.e. "vgdisplay vg??"). If so, then it is best to vgexport the unwanted groups.

The others have already given solutions for the other scenarios.

BTW, "pvremove" does not exist.