Why can’t I remove a Linux logical volume?

  • August 1, 2016
  • 0 Comments

If you are unable to unmount or lvremove a logical volume, verify that there are no processes holding the LV.

Locate the major/minor numbers for the logical volume you’re trying to remove (ie lvol0):

dmsetup info -c | grep lvol0

Take note of the 5th column, which indicates if a volume is “open,” and the 2nd and 3rd columns, which are the major and minor IDs, respectively. For example:

[root@eclipse ~]# dmsetup info -c | grep lvol5
datavg-lvol5         253  24 L--w    1    1      0 LVM-4WlscxDDEw5R9IvjgZYpu5FQeW9h835ADtQzXFr3cJ6SHEcgS4NFMxzaSKjUkedy
datavg-lvol5-cow     253  27 L--w    1    2      0 LVM-4WlscxDDEw5R9IvjgZYpu5FQeW9h835ADtQzXFr3cJ6SHEcgS4NFMxzaSKjUkedy-cow

Find any process attached to this volume by searching on the major and minor IDs discovered above:

lsof | grep "major,minor"

For example:

[root@eclipse ~]# lsof | grep "253,24"
beremote  14524      root   15r      BLK             253,24                1835186 /tmp/filehRrCD8 (deleted)

Shut down or kill any process still accessing the volume to continue unmounting and removal.

If no processes show as accessing the volume in lsof, check to make sure nothing is sharing the filesystem (i.e. rsync, nfs, or samba).

If you have verified that no processes are holding the LV open, verify that the LV is not mounted somewhere:

cat /proc/mounts

If the volume appears in the output, unmount it using the umount command.

taken from: http://kb.eclipseinc.com/kb/why-cant-i-remove-a-linux-logical-volume/

How helpful was this article to you?

Posting has been disabled.