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
How to stop and disable auditd on RHEL 7
Viewed 41531 times since Tue, Aug 6, 2019
RHCS6: Show/Add GFS2/GFS journals
Viewed 13238 times since Sun, Jun 3, 2018
12 Linux Rsync Options in Linux Explained
Viewed 12585 times since Wed, Oct 31, 2018
20 Practical Examples of RPM Commands in Linux rpm
Viewed 8574 times since Mon, Feb 18, 2019
Linux - How to monitor CPU usage
Viewed 6961 times since Fri, Jun 8, 2018
RHEL: iSCSI target/initiator configuration on RHEL6
Viewed 9415 times since Sat, Jun 2, 2018
HowTo: Create CSR using OpenSSL Without Prompt (Non-Interactive)
Viewed 14785 times since Mon, Feb 18, 2019
Lsyncd: live file syncronization across multiple Linux servers
Viewed 7661 times since Wed, Oct 31, 2018
How to configure an SSH proxy server with Squid
Viewed 3784 times since Sun, Dec 6, 2020
Linux get the list of FC HBA’s and WWPN
Viewed 4130 times since Tue, May 22, 2018