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
sed Delete / Remove ^M Carriage Return (Line Feed / CRLF) on Linux or Unix
Viewed 10287 times since Thu, Feb 7, 2019
Understanding System auditing with auditd
Viewed 9860 times since Fri, Apr 5, 2019
RHCS6: Show/Add GFS2/GFS journals
Viewed 12750 times since Sun, Jun 3, 2018
Linux 20 Netstat Commands for Linux Network Management
Viewed 9661 times since Mon, Sep 21, 2020
LVM basic
Viewed 2236 times since Sat, Jun 2, 2018
How do I add ethtool settings to a network device permanently?
Viewed 6619 times since Mon, May 21, 2018
RHCS: Install a two-node basic cluster
Viewed 9997 times since Sun, Jun 3, 2018
Open SSL Encrypt & Decrypt Files With Password Using OpenSSL
Viewed 8234 times since Mon, Feb 18, 2019
logrotate Log Rotate Configuration
Viewed 3193 times since Sun, Jan 12, 2020
How to deal with dmesg timestamps
Viewed 3486 times since Wed, Oct 3, 2018