Permalink
Browse files

udev: Persistent names for cached devices

Add /dev/bcache/by-uuid/ symlinks to cached devices.
  • Loading branch information...
1 parent 0344939 commit 0b2587b5bc3869cb96161273c32c9fe6be93b6e1 @g2p committed Jun 8, 2013
Showing with 11 additions and 1 deletion.
  1. +11 −1 61-bcache.rules
View
@@ -1,8 +1,18 @@
# register bcache devices as they come up
# man 7 udev for syntax
-SUBSYSTEM=="block", IMPORT{program}="/sbin/probe-bcache -o udev $tempnode"
+SUBSYSTEM!="block", GOTO="bcache_end"
+ACTION=="remove", GOTO="bcache_end"
+
+# Backing devices: scan, symlink, register
+IMPORT{program}="/sbin/probe-bcache -o udev $tempnode"
ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="bcache", \
RUN+="bcache-register $tempnode"
+# Cached devices: symlink
+DRIVER=="bcache", ENV{CACHED_UUID}=="?*", \
+ SYMLINK+="bcache/by-uuid/$env{CACHED_UUID}"
+
+LABEL="bcache_end"
+

0 comments on commit 0b2587b

Please sign in to comment.