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
HowTo: Send Email from an SMTP Server using the Command Line
Viewed 2085 times since Mon, Feb 18, 2019
RHEL: iSCSI target/initiator configuration on RHEL6
Viewed 8897 times since Sat, Jun 2, 2018
7 Tips – Tuning Command Line History in Bash
Viewed 5516 times since Fri, Jul 5, 2019
ZFS: Verify/change properties of a zfs filesystem
Viewed 2683 times since Sun, Jun 3, 2018
YUM How to use yum command on CentOS/RHEL
Viewed 7277 times since Thu, Oct 25, 2018
PROCESSOR AND MEMORY INFORMATION
Viewed 5658 times since Sat, Jun 2, 2018
Using IOzone for Linux disk performance analysis
Viewed 8025 times since Wed, Jul 25, 2018
Linux nslookup Command Examples for DNS Lookup
Viewed 9072 times since Sat, Sep 29, 2018
Szybkie sprawdzenie zewnętrznego adresu IP i hosta
Viewed 3451 times since Thu, May 24, 2018
LOGROTATE – ARCHIWIAZACJA LOGÓW
Viewed 2083 times since Fri, Nov 30, 2018