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
A Quick and Practical Reference for tcpdump
Viewed 12603 times since Fri, Jul 27, 2018
Linux Health Check Commands
Viewed 3231 times since Fri, Jun 8, 2018
LVM: Remove an existing Volume Group
Viewed 5465 times since Sat, Jun 2, 2018
RHEL: Force system to prompt for password in Single User mode
Viewed 7476 times since Sat, Jun 2, 2018
RHEL: Display swap/RAM size
Viewed 3388 times since Sat, Jun 2, 2018
high swap space utilization in LINUX
Viewed 6622 times since Fri, Jul 13, 2018
LVM: Reduce SWAP size by shrinking existing Logical Volume
Viewed 6300 times since Sat, Jun 2, 2018
Script to Offline and Remove A Disk In Linux
Viewed 2024 times since Mon, Jan 28, 2019
python learning
Viewed 1968 times since Wed, Dec 18, 2019
Lsyncd: live file syncronization across multiple Linux servers
Viewed 7064 times since Wed, Oct 31, 2018