richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
923a60
From 1e61121501f79e654a36bf2efb6a987f6a11c262 Mon Sep 17 00:00:00 2001
923a60
From: Michal Sekletar <msekletar@users.noreply.github.com>
923a60
Date: Wed, 17 Aug 2016 14:10:28 +0200
923a60
Subject: [PATCH] rules: introduce disk/by-id (model_serial) symlinks for NVMe
923a60
 drives (#3974)
923a60
923a60
$ ls -l /dev/disk/by-id/nvme*
923a60
lrwxrwxrwx. 1 root root 13 Aug 17 04:25 /dev/disk/by-id/nvme-HUSPR3216AHP301_STM0001B6780 -> ../../nvme0n1
923a60
lrwxrwxrwx. 1 root root 15 Aug 17 04:25 /dev/disk/by-id/nvme-HUSPR3216AHP301_STM0001B6780-part1 -> ../../nvme0n1p1
923a60
923a60
https://github.com/systemd/systemd/issues/1453
923a60
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=779ff75617099f4defe14e20443b95019a4c5ae8
923a60
923a60
Cherry-picked from: a5110c90303cf455db5062faef34d5724d12e2e9
923a60
Related: #1274651
923a60
---
923a60
 rules/60-persistent-storage.rules | 6 ++++++
923a60
 1 file changed, 6 insertions(+)
923a60
923a60
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
923a60
index cc01acb163..74f8f21f3a 100644
923a60
--- a/rules/60-persistent-storage.rules
923a60
+++ b/rules/60-persistent-storage.rules
923a60
@@ -26,6 +26,12 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
923a60
 KERNEL=="nvme*[0-9]n*[0-9]", ATTR{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}"
923a60
 KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}-part%n"
923a60
 
923a60
+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
923a60
+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{model}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_SERIAL}="$attr{model}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
923a60
+
923a60
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
923a60
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{model}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_SERIAL}="$attr{model}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
923a60
+
923a60
 # virtio-blk
923a60
 KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
923a60
 KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n"