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
Linux - How to get Memory information
Viewed 501 times since Fri, Jun 8, 2018
RHCS6: Debug and test multicast traffic between two hosts
Viewed 623 times since Sun, Jun 3, 2018
debian Install a newer kernel in Debian 9 (stretch) stable
Viewed 465 times since Sun, Sep 23, 2018
RHEL7: Configure automatic updates.
Viewed 405 times since Wed, Oct 17, 2018
linux manual tools
Viewed 527 times since Fri, Sep 28, 2018
RHEL: Rename a network interface on RHEL 7
Viewed 1989 times since Sat, Jun 2, 2018
Top 10 darmowych i publicznych serwerów DNS
Viewed 819 times since Tue, May 22, 2018
ZFS: Verify/change properties of a zfs filesystem
Viewed 614 times since Sun, Jun 3, 2018
Check Detailed CPU Information In Linux With CoreFreq [Advanced]
Viewed 569 times since Thu, Apr 18, 2019
Creating SWAP partition using FDISK & FALLOCATE commands
Viewed 265 times since Thu, Jan 16, 2020