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
Nagrywanie sesji SSH do pliku
Viewed 3026 times since Thu, May 24, 2018
How to create stunnel with systemd? stunnel
Viewed 9943 times since Thu, Jan 16, 2020
Fałszujemy rozpoznania skanerów #2
Viewed 3047 times since Mon, May 21, 2018
Tropienie pożeracza dysku
Viewed 2339 times since Thu, May 24, 2018
Securing /tmp and shm partitions
Viewed 3327 times since Fri, May 15, 2020
How To Use the Linux Auditing System on CentOS 7
Viewed 4042 times since Fri, Apr 5, 2019
How to enable Proxy Settings for Yum Command on RHEL / CentOS Servers
Viewed 12688 times since Thu, Jul 19, 2018
Szybkie sprawdzenie zewnętrznego adresu IP i hosta
Viewed 3451 times since Thu, May 24, 2018
INSTALACJA MIB SNMP W SYSTEMIE CENTOS/RHEL 6
Viewed 13075 times since Fri, Nov 30, 2018
YUM How to use yum command on CentOS/RHEL
Viewed 7279 times since Thu, Oct 25, 2018