LVM: Remove a Filesystem / Logical Volume

LVM: Remove a Filesystem / Logical Volume

# Tested on RHEL 5, 6 & 7

MNTPT=/testmntpt

VG=`mount | awk '{if ( $3 == "'$MNTPT'" ) print$1}' | cut -f4 -d'/' | cut -f1 -d '-'`
LV=`mount | awk '{if ( $3 == "'$MNTPT'" ) print$1}' | cut -f4 -d'/' | cut -f2 -d '-'`


umount $MNTPT

lvremove $VG/$LV
   Do you really want to remove active logical volume testlv? [y/n]: y
     Logical volume "testlv" successfully removed

vi /etc/fstab        # Remove corresponding line
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
debian How to Upgrade Debian 8 Jessie to Debian 9 Stretch
Viewed 934 times since Sun, Sep 23, 2018
Linux - How to get IP and MAC address of ethernet adapter in Linux
Viewed 758 times since Fri, Jun 8, 2018
15 Linux Yum Command Examples – Install, Uninstall, Update Packages
Viewed 1325 times since Thu, Oct 25, 2018
Super Grub2 Disk
Viewed 983 times since Wed, May 22, 2019
How to retrieve and change partition’s UUID Universally Unique Identifier on linux
Viewed 795 times since Tue, Jul 17, 2018
Using Kerberos security with Server for NFS
Viewed 1789 times since Wed, Jun 27, 2018
Cron YUM How to use yum-cron to automatically update RHEL/CentOS Linux
Viewed 642 times since Fri, Oct 26, 2018
RHEL: udev rules basics
Viewed 1553 times since Sat, Jun 2, 2018
SSH: Execute Remote Command or Script – Linux
Viewed 612 times since Mon, Feb 18, 2019
RHEL: Crash kernel dumps configuration and analysis on RHEL 6
Viewed 1743 times since Sat, Jun 2, 2018