Operating System - HP-UX
1753918 Members
7352 Online
108810 Solutions
New Discussion юеВ

Re: Removing(Destroying) LVM

 
SOLVED
Go to solution
Wills79
New Member

Removing(Destroying) LVM

May I get the detailed steps for removing Logical Volume(LV), Volume Group (VG) and Physical Volume (PV)
8 REPLIES 8
Nido
Trusted Contributor
Solution

Re: Removing(Destroying) LVM

Hi Wilson,

No detail reply for the above query if its to remove the LV then VG and PVs.
If LVs and PVs are associated with a particular VG then :

Your command would be:
1)Unmount the FileSystem:
umount

2) vgchange -a n
3)vgexport

You're done here:
4) Remove the entry from the /etc/fstab


Check the Documentation for all details of LVM in www.docs.hp.com.

This is one of the best documents among the LVM topics:
http://docs.hp.com/en/5991-1236/When_Good_Disks_Go_Bad_WP.pdf


Cheers!!

" Let Villagers Be Happy!! "
johnsonpk
Honored Contributor

Re: Removing(Destroying) LVM

Hello,

For removing the LV

1)unmount the filesystem using umount
2)#lvremove /dev/vgname/lvname

For removing VG

Do step 1 and 2 first for all lvs in the vg
3)reduce the vg by removing All but one physical volume can not be removed. The last physical volume must remain in the volume group so that the logical volume driver can continue to operate.

#vgreduce

4)remove the pv using vgremove command
#vgremove


You can also do a vgexport for removing vg from the system and skip step 3 and 4 in that case

#vgexport


For removing PV

pvremove

make sure that the pv is not part of any vg before executing pvremove command



Rgds
Johnson

Basheer_2
Trusted Contributor

Re: Removing(Destroying) LVM

Hello Wilson,

vgdisplay -v | grep " VG Name"
check if they are these avaiable

first remove the vg definitions
vgexport /dev/vg01

if these are SAN LUNS unpresent them to that host.

then after reboot you will not have NO_HW.

if these are not SAN LUNs, then use others methods.

James R. Ferguson
Acclaimed Contributor

Re: Removing(Destroying) LVM

Hi Wilson:

Two comments relative to those that have been offered already:

You do _not_ manually edit the '/etc/lvmtab'. It is a binary file maintained by the LVM commands only. A 'vgexport' of a volume group removes all of the associated volume's device files from the 'lvmtab'.

As for using 'pvremove' this may be unnecessary. If the physical disk will be used for another LVM volume group later, you will be 'pvcreate'ing the disk. The 'pvremove' command is used if an LVM disk is going to be used with a non-LVM volume manager (e.g. VxVM).

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: Removing(Destroying) LVM

Shalom,

lvremove (each logical volume)
vgremove volume group
pvremove (Which really does nothing)

To insure the data is removed, you need to lay down now data on the disk, otherwise it is easily recoverable.

If you plan on selling the disk, the only way to be sure the old data is gone is to create a new logical volume and fill it up with data.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor

Re: Removing(Destroying) LVM

Hi (again):

> SEP: pvremove (Which really does nothing)

Let's be clear. As I noted, 'pvremove' will erase the LVM metadata from a physical disk. That is, among other information, the PVID and VGID present on the physical disk are removed. This allows use of the disk by VxVM; _and/or_ prevents the disk from being 'vgimport'ed again on the same or on another server; _and_ will assist you in probing for unused physical disks where "used" indicates the presence of a VGID while the disk is otherwise absent from '/etc/lvmtab'.

Regards!

...JRF...
NMory
Respected Contributor

Re: Removing(Destroying) LVM

Hello Wilson:

Very simple,

1-Unmount all filesystems on VG in question

# unmount /

2-Deactivate the VG

# vgchange -a n

3-Export the VG

# vgexport

4-Remove the device files of the disks if you are going to physically remove them

# pvremove /dev/dsk/c#t#d#

5-If you are going to use the disks for another purpose you can pvcreate the disks with -f option or use mediainit to erase everything on the disk.

# pvcreate -f /dev/rdsk/c#t#d#

or

# mediainit /dev/dsk/c#t#d# (this takes some time)

LN
Wills79
New Member

Re: Removing(Destroying) LVM

Thanks all