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
Turbocharge PuTTY with 12 Powerful Add-Ons – Software for Geeks #3
Viewed 16155 times since Sun, Sep 30, 2018
20 Linux Command Tips and Tricks That Will Save You A Lot of Time linux
Viewed 6103 times since Thu, Apr 18, 2019
Linux 20 Netstat Commands for Linux Network Management
Viewed 10903 times since Mon, Sep 21, 2020
HowTo: Create CSR using OpenSSL Without Prompt (Non-Interactive)
Viewed 15518 times since Mon, Feb 18, 2019
red hat 7 tmpfiles service
Viewed 2643 times since Thu, Oct 11, 2018
ZPOOL: Add a mirror to a concat zpool
Viewed 4853 times since Sun, Jun 3, 2018
RHEL: Remove existing SAN LUNs
Viewed 15464 times since Sat, Jun 2, 2018
How to do a Filesystem Resize (ext3/ext4) on Redhat running on VMware
Viewed 11971 times since Wed, Jul 25, 2018
RHEL: Reserved space on a ext2/ext3/ext4 filesystem
Viewed 5887 times since Sun, May 27, 2018
LOGROTATE – ARCHIWIAZACJA LOGÓW
Viewed 2986 times since Fri, Nov 30, 2018