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 PAM configuration that allows or deny login via the sshd server
Viewed 807 times since Wed, Oct 3, 2018
How to disable SSH cipher/ MAC algorithms for Linux and Unix
Viewed 17225 times since Fri, Aug 21, 2020
O’Reilly’s CD bookshelf
Viewed 7607 times since Wed, Jun 27, 2018
RHEL: Extending a multipath LUN
Viewed 2282 times since Sun, May 27, 2018
RHCS6: Create a new Logical Volume / Global Filesystem 2 (GFS2)
Viewed 1122 times since Sun, Jun 3, 2018
Learn Linux System Auditing with Auditd Tool on CentOS/RHEL
Viewed 1759 times since Fri, Apr 5, 2019
How setting the TZ environment variable avoids thousands of system calls
Viewed 8280 times since Mon, May 21, 2018
Open SSL HowTo: Decode SSL Certificate
Viewed 4915 times since Mon, Feb 18, 2019
RHEL: What is "SysRq key" and how to use it
Viewed 2845 times since Sat, Jun 2, 2018
LVM: Reduce an existing Volume Group by removing one of its disks
Viewed 1042 times since Sat, Jun 2, 2018