systemd/rules.d/60-block.rules
Uday Shankar 225ddc4a72 udev: allow persistent storage rules for ublk devices
Tools such as lsblk which query the udev database instead of probing
devices directly fail when run on ublk devices. For instance, in the
following commands, the partition type is missing, despite the fact that
/dev/ublkb0 was just partitioned with a single Linux filesystem type
partition.

$ lsblk /dev/ublkb0
NAME       MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
ublkb0     259:0    0 31.3G  0 disk
└─ublkb0p1 259:1    0 31.2G  0 part
$ lsblk -o pkname,parttype /dev/ublkb0
PKNAME PARTTYPE

ublkb0

This happens because ublk devices are missing from a couple of
whitelists in the udev rules which are responsible for populating the
database with the data lsblk is looking for. Add the ublk devices to
these whitelists.
2024-10-11 10:29:26 +02:00

14 lines
721 B
Plaintext

# do not edit this file, it will be overwritten on update
# enable in-kernel media-presence polling
ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", \
ATTR{parameters/events_dfl_poll_msecs}="2000"
# forward scsi device event to corresponding block device
ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change"
# watch metadata changes, caused by tools closing the device node which was opened for writing
ACTION!="remove", SUBSYSTEM=="block", \
KERNEL=="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*|rbd*|zram*|ublkb*", \
OPTIONS+="watch"