1825024 Members
3124 Online
109678 Solutions
New Discussion юеВ

Re: remove volume group

 
coolhaier
New Member

remove volume group

During remove the volume group,what is the
difference between vgremove and vgexport?
persistence will make things better
4 REPLIES 4
steven Burgess_2
Honored Contributor

Re: remove volume group

Hi

How to remove a volume group
Note: the following example is using the volume group vg01 and the
logical volume lvhome

1) Backup all user data
2) Find the name of all logical volume in this volume group
vgdisplay -v /dev/vg01
3) unmount all logical volumes
Note: repeat the following command for each logical command
umount /dev/vg01/lvhome
4) Remove the volume group:
vgexport /dev/vg01
Note: using vgexport to remove a volume group is easier
and faster than using the vgreduce on each physical volume
except the last one, followed by a vgremove. The other
advantage is that the /dev/vg01 directory is also removed.


Hope this helps

Steve
take your time and think things through
S.K. Chan
Honored Contributor

Re: remove volume group

Actually the man pages explains it quite well already but here goes .. in my own words ..

The vgremove command removes the definiton of a VG from your system. Meaning after you run this you no longer can access the the data in that VG. The rules are however .. you must first lvremove all the LVs on the VG and vgreduce all the PV until one is left before you can remove a VG. A vgremove operation does NOT remove the directory of the device files (ie /dev/vgXX).

The vgexport can be used in 2 ways ..
1- To do a quick "remove" on a VG
2- In a situation where you want to ..
a) Physically move disks in a VG to another server while retaining it's LVM structure.
b) Change physical connection of an existing disks in a VG to another hardware path within the same server.
c) Rename an existing VG.

If you really wanted to remove a VG and found out that vgremove does not work, a quick fix is to use vgexport..
# vgexport vgXX
Doing that will remove the VG from the system BUT all the LVM structure remains intact on the disks and it cleans up /dev/vgXX for you too.

Hope this is good and brief enough explaination.
Thayanidhi
Honored Contributor

Re: remove volume group

Hi,

Once a VG is vgremoved the LVM structure and data cannot be recovered on the VG. If you want to permanetly delete a vg use vgremove

A VG cannot vgremoved unless all the lvremoved.

i.e. 1. back the the data
2.umount - all file systems
3.lvremove - all the lvs
4.vgreduce - all the pv's from vg exept the last pv
5.vgremove

Export is used in the following cases.
a.Want to move whole vg's pvs to another system without loosing data & LVM structure
b.Want to rename a VG
c.Want to change hardware paths of pv's of a VG (example, change SCSI id or Change in controller)

vgexport simply removes the vg directory (and updates lvmtab) from the system leaving the lvm structure/data on the disks.

Procedure
1. Backup data - Optional (for safer side)
2. umount all the lv's
3. vgexport

In the new system or in the same system after moving disks,

4. mkdir /dev/vgxx (xx=vgname)
5. mknod /dev/vgxx/group c 64 0xyy0000 (yy=hexadecimal vg id within the system)
6. vgimport /dev/vgxx
7. vgchange -a y /dev/vgxx
8. fsck all lvs
9. mount as required

Sorry for being so lengthy.

--TT
Attitude (not aptitude) determines altitude.
Roberto Arias
Valued Contributor

Re: remove volume group

Hi all:

I agree with chan.

regards
The man is your friend