digiturf.net

Destroying a Volume group in Linux LVM :


* * This is tested and worked under RHEL4.

[root@eglts04 ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  datavg  15   0   0 wz–n- 359.77G 359.77G

[root@eglts04 ~]# df -kh
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p3      36G   22G   13G  64% /
/dev/cciss/c0d0p1      99M   15M   80M  16% /boot
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – 
/dev/mapper/datavg-lvdata1
                      355G  113G  225G  34% /data

[root@eglts04 ~]# umount /data

[root@eglts04 ~]# vgdisplay /dev/mapper/datavg
  — Volume group —
  VG Name               datavg
  System ID
  Format                lvm2
  Metadata Areas        15
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  “Cur LV                1”
  Open LV               0
  Max PV                0
  Cur PV                15
  Act PV                15
  VG Size               359.77 GB
  PE Size               4.00 MB
  Total PE              92100
  Alloc PE / Size       92100 / 359.77 GB
  Free  PE / Size       0 / 0
  VG UUID               gTMba6-Aof6-ojKO-yaRd-mowh-q0UU-hhoU2l

[root@eglts04 ~]# lvchange -an /dev/mapper/datavg-lvdata1

[root@eglts04 ~]# lvremove /dev/mapper/datavg-lvdata1
Logical volume “lvdata1” successfully removed

[root@eglts04 ~]# vgdisplay /dev/mapper/datavg
  — Volume group —
  VG Name               datavg
  System ID
  Format                lvm2
  Metadata Areas        15
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
 “Cur LV                 0”
  Open LV               0
  Max PV                0
  Cur PV                15
  Act PV                15
  VG Size               359.77 GB
  PE Size               4.00 MB
  Total PE              92100
  Alloc PE / Size       0 / 0
  Free  PE / Size       92100 / 359.77 GB
  VG UUID               gTMba6-Aof6-ojKO-yaRd-mowh-q0UU-hhoU2l

[root@eglts04 ~]# vgremove /dev/mapper/datavg
  Volume group “datavg” successfully removed

[root@eglts04 ~]# pvs                    * # pvdisplay for earlier versions than LVM2.
  PV           VG   Fmt  Attr PSize  PFree
  /dev/sddlmaa      lvm2 —   23.99G 23.99G
  /dev/sddlmab      lvm2 —   23.99G 23.99G
  /dev/sddlmac      lvm2 —   23.99G 23.99G
  /dev/sddlmad      lvm2 —   23.99G 23.99G
  /dev/sddlmae      lvm2 —   23.99G 23.99G
  /dev/sddlmaf      lvm2 —   23.99G 23.99G
  /dev/sddlmag      lvm2 —   23.99G 23.99G
  /dev/sddlmah      lvm2 —   23.99G 23.99G
  /dev/sddlmai      lvm2 —   23.99G 23.99G
  /dev/sddlmaj      lvm2 —   23.99G 23.99G
  /dev/sddlmak      lvm2 —   23.99G 23.99G
  /dev/sddlmal      lvm2 —   23.99G 23.99G
  /dev/sddlmam      lvm2 —   23.99G 23.99G
  /dev/sddlman      lvm2 —   23.99G 23.99G
  /dev/sddlmao      lvm2 —   23.99G 23.99G

[root@eglts04 ~]# pvremove /dev/sddlmaa /dev/sddlmab /dev/sddlmac /dev/sddlmad /dev/sddlmae /dev/sddlmaf /dev/sddlmag /dev/sddlmah /dev/sddlmai /dev/sddlmaj /dev/sddlmak /dev/sddlmal /dev/sddlmam /dev/sddlman /dev/sddlmao

Labels on physical volume “/dev/sddlmaa” successfully wiped
Labels on physical volume “/dev/sddlmab” successfully wiped
Labels on physical volume “/dev/sddlmac” successfully wiped
Labels on physical volume “/dev/sddlmad” successfully wiped
Labels on physical volume “/dev/sddlmae” successfully wiped
Labels on physical volume “/dev/sddlmaf” successfully wiped
Labels on physical volume “/dev/sddlmag” successfully wiped
Labels on physical volume “/dev/sddlmah” successfully wiped
Labels on physical volume “/dev/sddlmai” successfully wiped
Labels on physical volume “/dev/sddlmaj” successfully wiped
Labels on physical volume “/dev/sddlmak” successfully wiped
Labels on physical volume “/dev/sddlmal” successfully wiped
Labels on physical volume “/dev/sddlmam” successfully wiped
Labels on physical volume “/dev/sddlman” successfully wiped
Labels on physical volume “/dev/sddlmao” successfully wiped

[root@eglts04 ~]# vi /etc/fstab           # comment / remove the entry of Volume group from it.

[root@eglts04 ~]# cat /etc/fstab
# This file is edited by fstab-sync – see ‘man fstab-sync’ for details
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
#/dev/datavg/lvdata1     /data                   ext3    defaults        1 2

Leave a Reply