aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel <g2p.code@gmail.com>2013-06-08 03:00:57 +0200
committerGabriel <g2p.code@gmail.com>2013-06-08 03:00:57 +0200
commit0b2587b5bc3869cb96161273c32c9fe6be93b6e1 (patch)
treea3cab48c0cc593679e5057ee5b0b0e83295e31cd
parent0344939e540f1b20901d61dcaffc8072062f57ed (diff)
downloadbcache-tools-0b2587b5bc3869cb96161273c32c9fe6be93b6e1.tar.gz
udev: Persistent names for cached devices
Add /dev/bcache/by-uuid/ symlinks to cached devices.
-rw-r--r--61-bcache.rules12
1 files changed, 11 insertions, 1 deletions
diff --git a/61-bcache.rules b/61-bcache.rules
index 7857914a..3a452491 100644
--- a/61-bcache.rules
+++ b/61-bcache.rules
@@ -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"
+