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
logrotate How log rotation works with logrotate
Viewed 8909 times since Sun, Jan 12, 2020
RHEL: Resize/disable /dev/shm filesystem
Viewed 14620 times since Sun, May 27, 2018
OEL 7 – How to disable IPv6 on Oracle Linux 7
Viewed 20161 times since Fri, Aug 3, 2018
Top 4 Reasons for Node Reboot or Node Eviction in Real Application Cluster (RAC) Environment
Viewed 90011 times since Thu, Jun 21, 2018
Exclude multiple files and directories with rsync
Viewed 2398 times since Wed, Oct 31, 2018
Linux 20 Netstat Commands for Linux Network Management
Viewed 9531 times since Mon, Sep 21, 2020
RHCS6: Quorum disk and heuristics
Viewed 4095 times since Sun, Jun 3, 2018
6 easy steps to setup offline two factor authentication in Linux
Viewed 12601 times since Mon, Apr 6, 2020
Linux Network (TCP) Performance Tuning with Sysctl
Viewed 11425 times since Fri, Aug 3, 2018
How do I add ethtool settings to a network device permanently?
Viewed 6479 times since Mon, May 21, 2018