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
Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT
Viewed 11520 times since Fri, May 15, 2020
List of 10 Must Know Oracle Database Parameters for Database Administrator
Viewed 131336 times since Thu, Jun 21, 2018
Find All Large Files On A Linux System
Viewed 2448 times since Mon, Oct 29, 2018
Tip: SSD and Linux. Enable TRIM and check if it works
Viewed 17384 times since Fri, May 15, 2020
Moving SSL Certificate from IIS to Apache
Viewed 2214 times since Mon, Feb 18, 2019
LVM: Create a new Volume Group
Viewed 2300 times since Sat, Jun 2, 2018
Modifying the inode count for an ext2/ext3/ext4 file system
Viewed 15737 times since Fri, Sep 18, 2020
IPTABLES linux
Viewed 17315 times since Sat, Jun 2, 2018
Linux Health Check Commands
Viewed 3440 times since Fri, Jun 8, 2018
high swap space utilization in LINUX
Viewed 6781 times since Fri, Jul 13, 2018