Attempt to remove manually LVM storage device for KVM VPS on the source server after successful migration fails:
CONFIG_TEXT: lvremove /dev/oldservervg/kvm101_img
Logical volume oldservervg/kvm101_img is used by another device.
Partition mapping is not removed for the device completely
- Access the node via SSH
- Remove the partition mapping for the VPS LVM on the server:
# kpartx -d /dev/oldservervg/kvm101_img
- Check the partition mapping on the server using the below command.
# dmsetup info -c | grep kvm101
oldserver962-kvm101_img 253 65 L--w 0 1 0 LVM-ASQ03eu39rsFa1GbQUJzmUfSoGPH91j4vRXZTbOhtw4lI4iprNPZDlAeMcZdaVhW
- Find the major,minor number in ‘lsof’ command output.
# lsof | grep "major,minor"
bckup 102585 0 19r BLK 253,65 0v12160 163622 /dev/dm-65 (deleted)
Stop the application corresponding to the PID or kill the process. The PID as per above example is 102585. You could stop the application using that PID or kill the PID directly using kill command:
# kill -9 [PID]
- Remove the dm-65 with dmsetup
# dmsetup remove /dev/dm-65
- Remove the VPS HDD on the server using the lvremove command on the server.
# lvremove /dev/vg_server962/kvm460_img
Do you really want to remove active logical volume kvm460_img? [y/n]: y
Logical volume "kvm460_img" successfully removed