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
RHEL: Displaying system info (firmware, serial numbers... )
Viewed 11472 times since Sun, May 27, 2018
ZFS: Verify/change properties of a zfs filesystem
Viewed 2280 times since Sun, Jun 3, 2018
Testing TLS/SSL encryption
Viewed 12855 times since Thu, Jan 16, 2020
Fedora 32: Simple Local File-Sharing with Samba CIFS Linux
Viewed 8413 times since Sun, Dec 6, 2020
socat: Linux / UNIX TCP Port Forwarder
Viewed 8878 times since Tue, Aug 6, 2019
RHCS6: Show/Add GFS2/GFS journals
Viewed 12414 times since Sun, Jun 3, 2018
debian Debian/Ubuntu Linux: Find If Installed APT Package Includes a Fix/Patch Via CVE Number
Viewed 9163 times since Sun, Sep 23, 2018
Sample logrotate configuration and troubleshooting part 2
Viewed 9178 times since Fri, Nov 30, 2018
RHCS6: Luci - the cluster management console
Viewed 2911 times since Sun, Jun 3, 2018
Learn how to align an SSD on Linux
Viewed 11723 times since Fri, May 15, 2020