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
Red Hat Cluster Tutorial
Viewed 990 times since Sun, Jun 3, 2018
How log rotation works with logrotate
Viewed 2142 times since Fri, Nov 30, 2018
Turbocharge PuTTY with 12 Powerful Add-Ons – Software for Geeks #3
Viewed 1770 times since Sun, Sep 30, 2018
How to create a Systemd service in Linux
Viewed 283 times since Mon, Dec 7, 2020
Linux - How to get CPU information
Viewed 759 times since Fri, Jun 8, 2018
stunnel Howto A Guide to create SSL access to a HTTP-only webserver with stunnel
Viewed 834 times since Fri, Sep 28, 2018
RHEL: Rename a network interface on RHEL 7
Viewed 2624 times since Sat, Jun 2, 2018
How to use yum-cron to automatically update RHEL/CentOS Linux 6.x / 7.x
Viewed 2304 times since Tue, Dec 4, 2018
6 rsync Examples to Exclude Multiple Files and Directories using exclude-from
Viewed 1028 times since Wed, Oct 31, 2018
LVM: Remove an existing Volume Group
Viewed 981 times since Sat, Jun 2, 2018