• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lvremove Command Fails With Error “LVM – Can’t remove open logical volume”

By admin

You want to delete a logical volume but, when running the command “lvremove”, you get the following output:

# umount /data
# lvremove /dev/vg1/lv1

Can't remove open logical volume "lv1"

Solution

The above error usually means that the volume is still in use by some process. To find the process that is keeping the logical volume open, follow the steps below.

1. Find the major,minor number corresponding to the Logical Volume:

# dmsetup info -c | grep [lvname]

For Example:

# dmsetup info -c | grep lv1
vg1-lv1 253 25 L--w 1 1 0 LVM-4YO6buASebpXKOmdwdzyUTZ39mfubEFG0wWxeM7gYLEisWPszglyTCA0xCAuohpF

2. Find the major,minor number in ‘lsof’ command output.

# lsof | grep "major,minor"

For Example:

# lsof | grep "253,25"
bckup 102585 0 19r BLK 253,25 0v12160 163622 /tmp/fileNabc3 (deleted)

3. Stop the application corresponding to the PID or kill the process. The PID as per above example is 102585. You could stop the application using that PID or kill the PID directly using kill command:

# kill -9 [PID]

4. Now removing the Logical Volume would complete successfully.

# lvremove vg1/lv1

Filed Under: Linux

Some more articles you might also be interested in …

  1. Understanding How an Email System Works
  2. How To Create An Almost Root Equivalent Users But Not Root Identical User in Linux
  3. CentOS / RHEL : How to find the creation time of LVM volume
  4. How to determine file and free space fragmentation of OCFS2
  5. lsof : Most commonly used examples
  6. fprintd Logs Messages into /var/log/messages Even If USEFPRINTD=no in /etc/sysconfig/authconfig (CentOS/RHEL 7)
  7. CentOS / RHEL 7 : systemctl replacements of legacy commands service and chkconfig
  8. How to Change Password Of An LXC Container User Account
  9. Examples of using dmsetup command in Linux
  10. How to resolve the error “-bash: xclock: command not found” in CentOS / RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ACPI in CentOS/RHEL 7
  • How to Use real-time query to access data on a physical standby database
  • CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  • How to Create a Physical Standby Database by Using SQL and RMAN Commands
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary