Description of problem: In /dev/mapper/ directory, link to /dev/dm-x device not created after vgmknodes. A vgchange --refresh makes does create the link. Version-Release number of selected component (if applicable): lvm2-2.03.16-3.el9.x86_64 kernel-5.14.0-162.6.1.el9_1.x86_64 Steps to Reproduce: [root@localhost ~]# lvs -ao +devices testvg LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices lvol0 testvg -wi-a----- 508.00m /dev/sda(0) - Remove and all comes back with vgchange --refresh: [root@localhost ~]# rm -rf /dev/mapper/testvg-lvol0 [root@localhost ~]# vgchange --refresh testvg [root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0 lrwxrwxrwx. 1 root root 7 Jan 18 16:45 /dev/mapper/testvg-lvol0 -> ../dm-2 - But using vgmknodes, link does not come back: [root@localhost ~]# rm -rf /dev/mapper/testvg-lvol0 [root@localhost ~]# vgmknodes [root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0 brw-rw----. 1 root disk 253, 2 Jan 18 16:46 /dev/mapper/testvg-lvol0 [root@localhost ~]# rm -rf /dev/mapper/testvg-lvol0 [root@localhost ~]# vgmknodes --refresh [root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0 brw-rw----. 1 root disk 253, 2 Jan 18 16:46 /dev/mapper/testvg-lvol0 - Even after trigger, link not re-created: [root@localhost ~]# rm -rf /dev/mapper/testvg-lvol0 [root@localhost ~]# vgmknodes [root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0 brw-rw----. 1 root disk 253, 2 Jan 18 16:52 /dev/mapper/testvg-lvol0 [root@localhost ~]# udevadm trigger [root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0 brw-rw----. 1 root disk 253, 2 Jan 18 16:52 /dev/mapper/testvg-lvol0 Actual results: No /dev/mapper link created Expected results: The vgmknodes command and vgmknodes --refresh command should recreate the link.
Can we get attached 'vgmknodes -vvvv' 'dmsetup info -c' 'udevadm info -e' Also note - user should be using/accessing LVs via '/dev/testvg/lvol0' - this is documented and recommended way how to access LVs. Usage of --refresh is actually better here since lvm2 command shouldn't be really used for creation of symlinks in /dev direcotry managed by udev.
This is expected - we rely fully on udev to create the /dev content (including the vgmknodes) .As such, we need to trigger appropriate uevents. The "--refresh" will cause the underlying DM mappings to get reloaded/resumed which in turn will trigger these uevents, the pure vgmknodes won't. We should add a note to vgmknodes man page about this.
Thanks Peter, Zdenek. As a note, I tested 'vgscan --mknodes' and it shows the same behavior as the regular vgmknodes command. I'm sure you prob already knew it was, just noting in the case you guys wanted to document that as well. Thanks again.