Page MenuHomeSoftware Heritage

Phantom device mapper volume usage in Proxmox: logical volume is used by another device
Closed, ResolvedPublic

Description

Virtual disk migration on Proxmox:beaubourg from beaubourg-ssd to Ceph fails with this kind of error:

can't deactivate LV '/dev/ssd/vm-107-disk-0':   Logical volume ssd/vm-107-disk-0 is used by another device.
volume deactivation failed: beaubourg-ssd:vm-107-disk-0 at /usr/share/perl5/PVE/Storage.pm line 1042.

It has been observed with vm-102-disk-0 and vm-107-disk-0 so far.

Event Timeline

ftigeot created this task.Jan 29 2019, 2:08 PM
ftigeot changed the task status from Open to Work in Progress.
ftigeot triaged this task as High priority.
ftigeot updated the task description. (Show Details)Jan 31 2019, 2:54 PM

Trying to manually disable the logical volume in question fails with the same error message

lvchange -a n /dev/ssd/vm-107-disk-0
Logical volume ssd/vm-107-disk-0 is used by another device.
ftigeot renamed this task from Phantom device mapper volume usage in Proxmox to Phantom device mapper volume usage in Proxmox: logical volume is used by another device.Feb 1 2019, 11:20 AM

This behavior appears to be caused by partitions present on top of device mappers devices.
These partitions in turn are used to create other dm devices and these latest device keep an open reference to the base one.

lsof does not show anything, only dmsetup info reports them.
A small example:

# dmsetup info
Name:              ssd-vm--210--disk--1p1
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      253, 30
Number of targets: 1
UUID: part1-LVM-huge-amount-of-digits-and-letters

Name:              ssd-vm--210--disk--1
State:             ACTIVE
Read Ahead:        8192
Tables present:    LIVE
Open count:        2
Event number:      0
Major, minor:      253, 9
Number of targets: 2
UUID: LVM-more-digits-and-letters

In this example, ssd-vm--210--disk--1 is opened twice:

  • once by the program using it to create a virtual machine
  • once by the ssd-vm--210--disk--1p1 device mapper device
ftigeot closed this task as Resolved.Jun 24 2019, 4:53 PM

The solution to this problem is to first identify the partition devices and then remove them:
dmsetup remove ssd-vm--100--disk--2p1

Regular disk image devices can then be removed in the same way or with traditional lvremove commands.