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
stunnel basics and pki standards
Viewed 10216 times since Fri, Sep 28, 2018
RHEL: Retrieve and generate a unique SCSI identifier
Viewed 4033 times since Sat, Jun 2, 2018
How to run command or code in parallel in bash shell under Linux or Unix
Viewed 4028 times since Tue, Aug 6, 2019
Understanding System auditing with auditd
Viewed 11557 times since Fri, Apr 5, 2019
How To Find Largest Top 10 Files and Directories On Linux / UNIX / BSD find
Viewed 4557 times since Mon, Oct 29, 2018
How to enable automatic security updates on CentOS 7 with yum-cron
Viewed 3138 times since Fri, Oct 26, 2018
Learn Linux System Auditing with Auditd Tool on CentOS/RHEL
Viewed 5467 times since Fri, Apr 5, 2019
RHEL: Multipathing basics
Viewed 10681 times since Sat, Jun 2, 2018
Moving SSL Certificate from IIS to Apache
Viewed 2608 times since Mon, Feb 18, 2019
Procedura powiekszania OCFS2 online
Viewed 6068 times since Fri, Jun 8, 2018