On one of my servers, I used to have a storage device, /dev/sdb, attached to it. That storage was used as an LVM physical volume. It has later been removed, and now I just noticed the following message:

[root@banan ~]# lvs
  Devices file PVID CuDRE3nMN5FMNqYLViHrnE1D7OFDlbX6 last seen on /dev/sdb not found.
  LV         VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root       almalinux -wi-ao---- <28.40g
  swap       almalinux -wi-ao----   2.01g

Based some research found online, there could be outdated device entries in the device files located in /etc/lvm/devices/system.devices.

[root@banan ~]# grep 'sdb' /etc/lvm/devices/system.devices
IDTYPE=devname IDNAME=/dev/sdb DEVNAME=/dev/sdb PVID=CuDRE3nMN5FMNqYLViHrnE1D7OFDlbX6

Indeed, there is an entry there. There is no longer a storage named /dev/sdb. Here is one command which can be used to verify this:

[root@banan ~]# udisksctl status
MODEL                     REVISION  SERIAL               DEVICE
--------------------------------------------------------------------------
KINGSTON SA2000M81000G    S5Z44106  50000000000C618D     nvme0n1
QEMU QEMU HARDDISK        2.5+      drive-scsi0          sda

So how to get rid of the entry of /dev/sdb? There are two ways can be done.

# lvmdevice --delpvid CuDRE3nMN5FMNqYLViHrnE1D7OFDlbX6

or…

# lvmdevices --deldev /dev/sdb

I’m going to use the first method.

[root@banan ~]# lvmdevices --delpvid CuDRE3nMN5FMNqYLViHrnE1D7OFDlbX6
  Devices file PVID CuDRE3nMN5FMNqYLViHrnE1D7OFDlbX6 last seen on /dev/sdb not found.

Now, let’s verify the result.

[root@banan ~]# grep 'sdb' /etc/lvm/devices/system.devices
[root@banan ~]# echo $?
1

[root@banan ~]# lvs
  LV         VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root       almalinux -wi-ao---- <28.40g
  swap       almalinux -wi-ao----   2.01g

The value 1 indicates there is no longer the sdb device.

That’s awesome. The annoying message has disappeared and I learned something new about LVM.

References:

  1. Linux LVM - PVID last seen on
  2. Deleting Old LVMS
  3. Devices file PVID last seen on /dev/sda not found.