Removing vg and lv after physical drive has been removed
Solution 1:
The solution was to run dmsetup, in this case the two commands
dmsetup remove vg04-vz
dmsetup remove vg04-swap
Before doing this, I checked with the command 'dmsetup info' that the 'open count' for both LV's were zero.
WARNING: dmsetup can wreck serious havoc with your disks so anyone using this information in the future please make sure you read the man page.
Solution 2:
I experienced similar after removing a VMware disk /dev/sdb
.
Use lsscsi
to determine which device is being used (you may need to install the program)
then run lsscsi
:
# lsscsi
[1:0:0:0] cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0
[2:0:0:0] disk VMware Virtual disk 1.0 /dev/sda
[2:0:1:0] disk VMware Virtual disk 1.0 /dev/sdb <== the removed physical disk
[2:0:2:0] disk VMware Virtual disk 1.0 /dev/sdc
Now write the delete file with
# echo 1 > /sys/class/scsi_device/2\:0\:1\:0/device/delete
The device is immediately gone.
Solution 3:
vgchange -a n /dev/vg04
If you have logical volumes still active you may have to
lvchange -a n /dev/vg04/swap
lvchange -a n dev/vg04/vz
etc.