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
ZPOOL: Detach a submirror from a mirrored zpool
Viewed 2930 times since Sun, Jun 3, 2018
How To Create a Linux Swap File
Viewed 2708 times since Fri, Jun 8, 2018
How to find your System details using inxi
Viewed 3604 times since Sat, Jun 2, 2018
How To Run Multiple SSH Command On Remote Machine And Exit Safely
Viewed 4621 times since Tue, Aug 6, 2019
SSL HowTo: Decode CSR
Viewed 5257 times since Mon, Feb 18, 2019
How To Set Up an SSL Tunnel Using Stunnel on Ubuntu
Viewed 3526 times since Fri, Sep 28, 2018
Configuring VLAN interfaces in Linux
Viewed 5982 times since Mon, May 21, 2018
Procedura powiekszania OCFS2 online
Viewed 5641 times since Fri, Jun 8, 2018
How to recover error - Audit error: dispatch err (pipe full) event lost
Viewed 26434 times since Tue, Aug 6, 2019
20 Linux Command Tips and Tricks That Will Save You A Lot of Time linux
Viewed 5034 times since Thu, Apr 18, 2019