[Vserver] lvremove: "Can't remove open logical volume"

From: Mehdi Bennani <joeytriviano_at_gmail.com>
Date: Fri 15 Sep 2006 - 09:01:41 BST
Message-ID: <4a1c34ee0609150101q4fa839b9mf5e2b43b1efb96da@mail.gmail.com>

Hello,

I am setting up a host with LVM volumes for each vserver.

I made scripts for vserver creation which include on-the-fly Logical Volume
creation, formating and mount, that works pretty well.

Things are getting worse when I try to delete a Logical Volume after having
the vserver stopped and its partition umounted:

I randomly get this error:

"Can't remove open logical volume"

Here are basic examples of the scripts:

CREATION
usage:
vcreate [name]

#!/bin/bash
lvcreate -L5000 -n"$1" vg0
mkreiserfs -f /dev/vg0/"$1"
mkdir /vservers/"$1"
mount /dev/vg0/"$1" /vservers/"$1"
vserver "$1" build -m skeleton

DELETION
usage:
vdelete [name]

#!/bin/bash
vserver "$1" stop
lsof /vservers/"$1"
umount -f /vservers/"$1"
lvremove -f /dev/vg0/"$1"

The Logical Volume seems actually umounted because cat /proc/mounts doesn't
mention it, but *something* is still using it and I cannot figure out what.

A reboot of the host corrects the problem but I can't reboot the whole
system each time I need to delete a vserver.

I have found a log chat at
http://irc.13thfloor.at/LOG/2006-04/LOG_2006-04-22.txt where someone was
experiencing exaclty the same problem but no solution was found at the
moment.

Thanks in advance for any help or ideas!

Regards,

Mehdi Bennani

=================================system
info==================================

vserver:~# vserver-info
Versions:
                   Kernel: 2.6.12lvs
                   VS-API: 0x00020001
             util-vserver: 0.30.210; Jun 11 2006, 14:57:10

Features:
                       CC: gcc, gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)
                      CXX: g++, g++ (GCC) 3.3.5 (Debian 1:3.3.5-13)
                 CPPFLAGS: ''
                   CFLAGS: '-Wall -g -O2 -std=c99 -Wall -pedantic -W'
                 CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W
-fmessage-length=0'
               build/host: i386-pc-linux-gnu/i386-pc-linux-gnu
             Use dietlibc: yes
       Build C++ programs: yes
       Build C99 programs: yes
           Available APIs: compat,v11,fscompat,v13,net,oldproc,olduts
            ext2fs Source: e2fsprogs
    syscall(2) invocation: alternative
      vserver(2) syscall#: 273/glibc

Paths:
                   prefix: /usr
        sysconf-Directory: /etc
            cfg-Directory: /etc/vservers
         initrd-Directory: $(sysconfdir)/init.d
       pkgstate-Directory: /var/run/vservers
          vserver-Rootdir: /var/lib/vservers

_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Fri Sep 15 09:05:05 2006

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 15 Sep 2006 - 09:05:10 BST by hypermail 2.1.8