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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. Rsyslog : How to Send log files to remote server in CentOS/RHEL 6,7
  2. Beginners Guide to NFS in CentOS / RHEL
  3. How to disable or enable an HBA without reboot under CentOS/RHEL
  4. How to move /var on a separate disk as a separate mount point (Online)
  5. How to remove bonding Network configuration in CentOS/RHEL
  6. Linux OS Service ‘cups’
  7. Oracle OS watcher (OSWatcher) – Understanding oswiostat
  8. nohup Command Options in Linux
  9. How to gzip all or specific files in Linux
  10. How to disable timeout in ssh during login prompt (login session inactivity) in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright