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
How log rotation works with logrotate
Viewed 4487 times since Fri, Nov 30, 2018
linux unix aix banner /etc/issue
Viewed 1715 times since Fri, Aug 3, 2018
RHEL: Crash kernel dumps configuration and analysis on RHEL 6
Viewed 4315 times since Sat, Jun 2, 2018
RHEL: Enabling standard ftp/telnet
Viewed 2725 times since Sun, May 27, 2018
How to configure an SSH proxy server with Squid
Viewed 2632 times since Sun, Dec 6, 2020
linux ssh How to Hide the OpenSSH Version Details when Telnet to Port 22
Viewed 3719 times since Wed, Apr 22, 2020
logrotate - rotates, compresses, and mails system logs.
Viewed 1503 times since Fri, Nov 30, 2018
LVM: Extend an existing Volume Group by adding a new disk
Viewed 1778 times since Sat, Jun 2, 2018
RHEL: GPT/MBR partition tables (using disks larger than 2 TiB)
Viewed 11885 times since Sun, May 27, 2018
Tip: SSD and Linux. Enable TRIM and check if it works
Viewed 7104 times since Fri, May 15, 2020