lvremove fails with "can't remove open logical volume" on Red Hat Enterprise Linux 5

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 5

Issue

  • Sometimes the lvremove fails with 'Can't remove open logical volume "VolumeName"'

    # lvremove /dev/VG0/LV4 
      Can't remove open logical volume "LV4" 
    
  • The 'mount' command shows it is unmounted

  • The 'lsof' command shows no files open from the snapshot mount point
  • The 'dmsetup info -c' command shows the LV is still opened.
  • FS was unmounted with 'umount -l'

Resolution

  • Stop the third-party process.
  • If lazy unmount was used on the FS (i.e. umount -l) then only a reboot will release the opened file(s).

Root Cause

  • The Backup exec daemon (beremote) was holding the snapshots opened leading lvremove to fail.

Diagnostic Steps

  1. check the major and the minor for the volume.

    # dmsetup_info_-c | grep LV4
    VG0-LV4 252   4 L--w    1    1      0 LVM-oLlI7fxWpX5fIx8M2mNFCQVyMsAoSmgHPvdQfEY39C95xWHtVcaEQ9nlcucj0Rtl
    
  2. check which process is referencing the device.

    # lsof | grep 253,3
    beremote   2308        0   10r      BLK              252,4             8880186 /tmp/filexVRTwQ(deleted)
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments