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
Top 10 darmowych i publicznych serwerów DNS
Viewed 838 times since Tue, May 22, 2018
IPTABLES linux
Viewed 9787 times since Sat, Jun 2, 2018
RHEL: Services basic management - chkconfig
Viewed 2891 times since Sat, Jun 2, 2018
How to Migrate from RHEL 8 to CentOS 8
Viewed 101 times since Fri, May 15, 2020
WatchDog watchdog.sh script for checking server running
Viewed 1773 times since Tue, Jul 31, 2018
Cron YUM How to use yum-cron to automatically update RHEL/CentOS Linux
Viewed 420 times since Fri, Oct 26, 2018
Fix rpmdb: Thread died in Berkeley DB library
Viewed 316 times since Fri, Feb 14, 2020
Open SSL HowTo: Decode SSL Certificate
Viewed 482 times since Mon, Feb 18, 2019
Install OpenVPN On CentOS / RHEL 7
Viewed 116 times since Fri, May 15, 2020
Testing TLS/SSL encryption
Viewed 448 times since Thu, Jan 16, 2020