[CentOS] LVM not removing LV

Sat Aug 23 14:49:51 UTC 2008
William L. Maltby <CentOS4Bill at triad.rr.com>

On Sat, 2008-08-23 at 06:46 -0700, Mag Gam wrote:
> There are too many mount points. Close to 120. I am fairly certain
> this volume is not mouted. I did a grep -i lvname /proc/mounts

May be your problem?

$ cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
/dev /dev tmpfs rw 0 0
/proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
none /selinux selinuxfs rw 0 0
/proc/bus/usb /proc/bus/usb usbfs rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/sdb1 /boot ext3 rw,data=ordered 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
/etc/auto.misc /misc autofs rw,fd=6 # snipped the rest
rw,fd=12,pgrp=2632,timeout=300,minproto=5,maxproto=5,indirect 0 0

But look at this.

$ mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sdb1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

Note that the root file system is not mounted by the kernel using the
LVM name, but rootfs. But mount shows (it uses /etc/mtab) the LVM name.

Maybe using the mount command, or a grep on etc/mtab, will show that the
volume is mounted somewhere.

Another possibility is to use lsof (see the man page, maybe the +D
parameter will be useful) or maybe fuser (see the man page again). Keep
in mind that the volume maybe be accessed with names other than VolG*.

E.g.

# find /dev -exec ls -dl {} \;|grep 253
brw------- 1 root root 253, 0 Aug 23 07:28 /dev/root
brw-rw---- 1 root disk 253, 1 Aug 23
              07:28 /dev/mapper/VolGroup00-LogVol01
brw-rw---- 1 root disk 253, 0 Aug 23
              07:28 /dev/mapper/VolGroup00-LogVol00

$ ls -l /dev/mapper/
total 0
crw------- 1 root root  10, 63 Aug 23 07:28 control
brw-rw---- 1 root disk 253,  0 Aug 23 07:28 VolGroup00-LogVol00
brw-rw---- 1 root disk 253,  1 Aug 23 07:28 VolGroup00-LogVol01

$ ls -ld /dev/Vol*
drwx------ 2 root root 80 Aug 23 07:28 /dev/VolGroup00

> <snip>

HTH
-- 
Bill