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
RHEL: Crash kernel dumps configuration and analysis on RHEL 6
Viewed 5074 times since Sat, Jun 2, 2018
tcpdump usage examples
Viewed 2504 times since Fri, Jul 27, 2018
chrt command: Set / Manipulate Real Time Attributes of a Linux Process
Viewed 11392 times since Mon, Feb 17, 2020
A Quick and Practical Reference for tcpdump
Viewed 12737 times since Fri, Jul 27, 2018
Top 25 Best Linux Performance Monitoring and Debugging Tools
Viewed 7318 times since Sun, Sep 30, 2018
How to retrieve and change partition’s UUID Universally Unique Identifier on linux
Viewed 3298 times since Tue, Jul 17, 2018
Managing temporary files with systemd-tmpfiles on Red Hat Enterprise Linux 7
Viewed 9900 times since Sun, Nov 22, 2020
RHEL: What is "SysRq key" and how to use it
Viewed 5623 times since Sat, Jun 2, 2018
6 rsync Examples to Exclude Multiple Files and Directories using exclude-from
Viewed 5245 times since Wed, Oct 31, 2018
debian How to Upgrade Debian 8 Jessie to Debian 9 Stretch
Viewed 2560 times since Sun, Sep 23, 2018