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
8 Vim Tips And Tricks That Will Make You A Pro User
Viewed 3824 times since Fri, Apr 19, 2019
Linux: Disks diagnostic using smartctl
Viewed 16031 times since Wed, Jul 25, 2018
Jak wygenerować silne hasła jednorazowe w Linuksie?
Viewed 2973 times since Thu, May 24, 2018
20 IPtables Examples For New SysAdmins
Viewed 2889 times since Fri, May 15, 2020
How to sort IP addresses in Linux
Viewed 4431 times since Sun, May 20, 2018
Linux Audit The Linux security blog about Auditing, Hardening, and Compliance lynis
Viewed 2853 times since Thu, Jan 16, 2020
Linux: how to monitor the nofile limit
Viewed 11673 times since Wed, Jul 25, 2018
FIO (Flexible I/O) – a benchmark tool for any operating system
Viewed 20412 times since Wed, Jul 25, 2018
Linux ssh Hide OpenSSH Version Banner
Viewed 56648 times since Wed, Apr 22, 2020
debian How to Upgrade Debian 8 Jessie to Debian 9 Stretch
Viewed 3125 times since Sun, Sep 23, 2018