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
RHEL: Crash kernel dumps configuration and analysis on RHEL 7
Viewed 6986 times since Sat, Jun 2, 2018
How to Install and use Lsyncd on CentOS 7 / RHEL 7 rsync
Viewed 4188 times since Wed, Oct 31, 2018
ZPOOL: Create a new zpool for zfs filesystems
Viewed 2141 times since Sun, Jun 3, 2018
Logowanie za pomocą kluczy Secure Shell
Viewed 2849 times since Thu, May 24, 2018
How to use yum command on CentOS/RHEL
Viewed 10870 times since Wed, Oct 17, 2018
awk printf
Viewed 14924 times since Wed, Aug 19, 2020
HOWTO: Use SSL/port 465 in smarthost stunnel
Viewed 3701 times since Fri, Sep 28, 2018
Using IOzone for Linux disk performance analysis
Viewed 7591 times since Wed, Jul 25, 2018
Secure Secure Shell
Viewed 10605 times since Fri, Aug 21, 2020
Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT
Viewed 11202 times since Fri, May 15, 2020