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
Cron YUM How to use yum-cron to automatically update RHEL/CentOS Linux
Viewed 2622 times since Fri, Oct 26, 2018
LVM basic
Viewed 2341 times since Sat, Jun 2, 2018
What UUIDs can do for you
Viewed 1904 times since Tue, Jul 17, 2018
CONFIGURE OCFS2
Viewed 8250 times since Sat, Jun 2, 2018
RHEL: Extending a multipath LUN
Viewed 5237 times since Sun, May 27, 2018
RHCS6: Clustered LVM
Viewed 2403 times since Sun, Jun 3, 2018
20 Linux YUM (Yellowdog Updater, Modified) Commands for Package Management YUM
Viewed 11461 times since Thu, Oct 25, 2018
tcpdump usage examples
Viewed 2437 times since Fri, Jul 27, 2018
RHCS: Configure an active/backup pacemaker cluster
Viewed 9163 times since Sun, Jun 3, 2018
high swap space utilization in LINUX
Viewed 6683 times since Fri, Jul 13, 2018