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
RHCS6: Luci - the cluster management console
Viewed 3118 times since Sun, Jun 3, 2018
Using grep to find string in files
Viewed 2075 times since Fri, May 15, 2020
RHEL: Change system’s hostname
Viewed 3385 times since Sun, May 27, 2018
10 nmap Commands Every Sysadmin Should Know
Viewed 9825 times since Wed, May 22, 2019
Przekazywanie portów TCP rinetd
Viewed 43400 times since Thu, May 24, 2018
SYS: Configure a local repository. local repo
Viewed 10854 times since Mon, Oct 29, 2018
HowTo: Create CSR using OpenSSL Without Prompt (Non-Interactive)
Viewed 13913 times since Mon, Feb 18, 2019
How to retrieve and change partition’s UUID Universally Unique Identifier on linux
Viewed 2953 times since Tue, Jul 17, 2018
Exclude multiple files and directories with rsync
Viewed 2400 times since Wed, Oct 31, 2018
How To Run Multiple SSH Command On Remote Machine And Exit Safely
Viewed 4180 times since Tue, Aug 6, 2019