Hi, I'm using LVM, having / and /home as logical volumes and a backup script creating a logical snapshot volume of each in the process.
Since I use gentoo (comming from arch), my backup script fails rather often with the error message 'Can't remove open logical volume <volume>'. The script worked fine on arch before. The partition setup did not change. Sometimes it works fine, sometimes it just fails. As a workaround, I let the script just lvremove the snapshot three times with 5 seconds sleeping between the tries and the overall success rate for the script improved... The chance is about 40% lvremove succeeds at a given time and doesn't seem to in- or decrease when calling lvremove successively with a five second delay, though if it fails once, it tends to fail again more often if called within the next two or three seconds. Here is an example of the command failing once more after the backup script aborted. The second time it works. I did NOTHING but the commands listed below in these 30 seconds or so: (note: dmsetup says "open: 0" in the first place!) kira namor # dmsetup info -c vg-snap_root Name Maj Min Stat Open Targ Event UUID vg-snap_root 253 5 L--w 0 1 0 LVM- ayg5GD1dYyrkkan1pLa8WszI7UrQpy9YE2ynOTtHoSNckKdehm3XMIgkw7p8z69X kira namor # lvremove /dev/vg/snap_root Can't remove open logical volume "snap_root" kira namor # lsof /dev/vg/snap_root kira namor # fuser -a /dev/vg/snap_root /dev/vg/snap_root: kira namor # lvremove /dev/vg/snap_root Do you really want to remove active logical volume snap_root? [y/n]: y Logical volume "snap_root" successfully removed What I tried so far was: -> calling: lvchange -an $SNAP_PARTITION #fails iff lvremove fails -> updating to lvm2-2.02.56-r3 and updating the initramfs #fixes nothing I have no idea what causes this random behavior. Help much appreciated. Regards, Roman Naumann