Discussion:
[PATCH v2] udev rules: add by-location symlinks to nvme devices
(too old to reply)
C***@dell.com
2017-11-28 22:00:28 UTC
Permalink
On systems with multiple 2.5-inch form factor PCIe SSD devices, locating the
physical drive can be made easier with symlinks that contain the drive bay
and slot information like this:

/dev/disk/by-path/PCIe_SSD_in_Slot_9_Bay_1-nvme0n1 -> ../../nvme0n1
/dev/disk/by-path/PCIe_SSD_in_Slot_9_Bay_1-nvme0n2 -> ../../nvme0n2
/dev/disk/by-path/PCIe_SSD_in_Slot_9_Bay_1-nvme1n1 -> ../../nvme1n1

The bay/slot information is read from the sysfs label attribute available for
each NVMe device.

v2: Incorporate Lennart's feedback
Do not shell out to "tr".
Create link in "by-path", not "by-location".
Remove "DRIVERS==nvme" check.
Do not make the rule vendor specific.

Signed-off-by: Charles Rose <***@dell.com>
---
rules/60-persistent-storage.rules | 2 ++
1 file changed, 2 insertions(+)

diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
index 0de8cf3a1..2d3f7dc72 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -19,6 +19,8 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
KERNEL=="nvme*[0-9]n*[0-9]", ATTR{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}"
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}-part%n"

+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{label}=="?*", SYMLINK+="disk/by-path/$attr{label}-%k", OPTIONS="string_escape=replace"
+
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{wwid}=="?*", ENV{ID_WWN}="$attr{wwid}"
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
--
2.14.3
systemd github import bot
2017-11-28 23:05:57 UTC
Permalink
Patchset imported to github.
To create a pull request, one of the main developers has to initiate one via:
<https://github.com/systemd/systemd/compare/master...systemd-mailing-devs:20171128220027.11709-1-charles_rose%40dell.com>

--
Generated by https://github.com/haraldh/mail2git
Lennart Poettering
2017-11-29 09:36:10 UTC
Permalink
Post by C***@dell.com
On systems with multiple 2.5-inch form factor PCIe SSD devices, locating the
physical drive can be made easier with symlinks that contain the drive bay
The first version you submitted through github, could you submit this
one too, please?

Thanks,

Lennart
--
Lennart Poettering, Red Hat
Loading...