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: ACLs basics
Viewed 2445 times since Sun, May 27, 2018
RHEL: Reinstalling Boot Loader on the Master Boot Record (MBR)
Viewed 1958 times since Sun, May 27, 2018
INSTALACJA MIB SNMP W SYSTEMIE CENTOS/RHEL 6
Viewed 10477 times since Fri, Nov 30, 2018
RHEL: Resize/disable /dev/shm filesystem
Viewed 9844 times since Sun, May 27, 2018
LVM: Recovering Physical Volume Metadata
Viewed 11791 times since Sat, Jun 2, 2018
LUKS List available methods of encryption for LUKS
Viewed 1263 times since Fri, Jul 13, 2018
ubuntu How to reset lost root password on Ubuntu 16.04 Xenial Xerus Linux
Viewed 6886 times since Tue, Dec 8, 2020
ZPOOL: Add a mirror to a concat zpool
Viewed 1994 times since Sun, Jun 3, 2018
20 Linux YUM (Yellowdog Updater, Modified) Commands for Package Management YUM
Viewed 9948 times since Thu, Oct 25, 2018
RHEL: GPT/MBR partition tables (using disks larger than 2 TiB)
Viewed 10649 times since Sun, May 27, 2018