LVM: Remove an existing Volume Group

LVM: Remove an existing Volume Group

# Tested on RHEL 5, 6 & 7

VG=testvg

vgdisplay -v $VG
    Using volume group(s) on command line.
  --- Volume group ---
  VG Name               testvg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  60
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               508.00 MiB
  PE Size               4.00 MiB
  Total PE              127
  Alloc PE / Size       64 / 256.00 MiB
  Free  PE / Size       63 / 252.00 MiB
  VG UUID               MgAY7y-AVfr-FOFP-5RVO-jHA8-Obel-UK2M9k

  --- Logical volume ---
  LV Path                /dev/testvg/testlv
  LV Name                testlv
  VG Name                testvg
  LV UUID                uwa2U4-C2J4-pjPK-CYT4-jvMO-qgj7-gabWBN
  LV Write Access        read/write
  LV Creation host, time ciento3.localdomain, 2016-02-25 14:19:41 +0100
  LV Status              available
  # open                 1
  LV Size                256.00 MiB
  Current LE             64
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:8

  --- Physical volumes ---
  PV Name               /dev/sde1
  PV UUID               jgt69o-8OoG-3WNo-9ens-GBD2-vrqu-yRHDUB
  PV Status             allocatable
  Total PE / Free PE    127 / 63



# Before removing Volume Group remember that data (if any) won't be recoverable. Take into
# account any filesystem/logical volume belonging to volume group. Such is my case; I will
# destroy volume group and all related objects
 
vgremove $VG
   Do you really want to remove volume group "testvg" containing 1 logical volumes? [y/n]: y
     Can't remove open logical volume "testlv"

df -h
   [...]
   /dev/mapper/testvg-testlv
                         248M   11M  226M   5% /testmntpt

umount /testmntpt

rmdir
/testmntpt

vgremove $VG
   Do you really want to remove volume group "testvg" containing 1 logical volumes? [y/n]: y
   Do you really want to remove active logical volume testlv? [y/n]: y
     Logical volume "testlv" successfully removed
     Volume group "testvg" successfully removed
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Testing TLS/SSL encryption
Viewed 13078 times since Thu, Jan 16, 2020
Install Security Patches or Updates Automatically on CentOS and RHEL
Viewed 1660 times since Fri, Oct 26, 2018
8 Vim Tips And Tricks That Will Make You A Pro User
Viewed 2820 times since Fri, Apr 19, 2019
How to enable Proxy Settings for Yum Command on RHEL / CentOS Servers
Viewed 12258 times since Thu, Jul 19, 2018
OEL 7 – How to disable IPv6 on Oracle Linux 7 – Follow Up
Viewed 9326 times since Wed, Jul 25, 2018
HowTo: Retrieve Email from a POP3 Server using the Command Line
Viewed 10314 times since Mon, Feb 18, 2019
stunnel bacula
Viewed 1934 times since Fri, Sep 28, 2018
chrt command: Set / Manipulate Real Time Attributes of a Linux Process
Viewed 10797 times since Mon, Feb 17, 2020
Jak znaleźć najszybszy publiczny serwer DNS w Polsce?
Viewed 2466 times since Mon, May 21, 2018
stunnel basics and pki standards
Viewed 9338 times since Fri, Sep 28, 2018