bcache-tools: changes to make the udev rules work
Hi!
When making bcache tools run on Fedora I had to make some small tweaks on the udev rules file:
- first trying with blkid doesn't work, because it doesn't know about bcache
- full pathnames are needed, also for bcache-register because udev doesn't include /sbin and /usr/sbin in PATH.
This is the diff:
61-bcache.rules 2013-08-25 15:53:32.690312711 +0200 renamed from 61-bcache.rules.rules 2013-08-20 22:03:46.000000000 +0200 +4 -4
@@ -5,14 +5,14 @@ ACTION=="remove", GOTO="bcache_end" # Backing devices: scan, symlink, register -IMPORT{program}="/sbin/blkid -o udev $tempnode" +#IMPORT{program}="/usr/sbin/blkid -o udev $tempnode" # blkid and probe-bcache can disagree, in which case don't register -ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end" +#ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end" -IMPORT{program}="/sbin/probe-bcache -o udev $tempnode" +IMPORT{program}="/usr/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" + RUN+="/usr/lib/udev/bcache-register $tempnode" LABEL="bcache_backing_end" # Cached devices: symlink
Any feedback is welcome,
Rolf
Quoted 1 line · Rolf Fokkens
Hi!
Hello!
Quoted 6 lines
When making bcache tools run on Fedora I had to make some small tweaks on the udev rules file:
- first trying with blkid doesn't work, because it doesn't know about bcache
- full pathnames are needed, also for bcache-register because udev doesn't include /sbin and/usr/sbinin PATH.
The blkid check is to make sure that there isn't a non-bcache superblock. blkid doesn't need to understand bcache for this.
Make path changes if you really need, but udev is supposed to find unqualified paths like bcache-register in $udevlibdir ( /lib/udev on debian, possibly /usr/lib/udev in fedora).
Quoted 15 lines
This is the diff:
--- bcache-tools-20130820/61-bcache.rules.rules 2013-08-20
22:03:46.000000000 +0200
+++ bcache-tools-20130820/61-bcache.rules 2013-08-25
15:53:32.690312711 +020061-bcache.rules 2013-08-25 15:53:32.690312711 +0200 renamed from 61-bcache.rules.rules 2013-08-20 22:03:46.000000000 +0200 +2
-2@@ -5,14 +5,14 @@ ACTION=="remove", GOTO="bcache_end" # Backing devices: scan, symlink, register -IMPORT{program}="/sbin/blkid -o udev $tempnode" +#IMPORT{program}="/usr/sbin/blkid -o udev $tempnode" # blkid and probe-bcache can disagree, in which case don't register -ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end" +#ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache",
Quoted 1 line
GOTO="bcache_backing_end"
Those first two changes should be reverted.
61-bcache.rules 2013-08-25 15:53:32.690312711 +0200 line 12
Quoted 2 lines
61-bcache.rules 2013-08-25 15:53:32.690312711 +0200 renamed from 61-bcache.rules.rules 2013-08-20 22:03:46.000000000 +0200 +1
-1-IMPORT{program}="/sbin/probe-bcache -o udev $tempnode" +IMPORT{program}="/usr/sbin/probe-bcache -o udev $tempnode"
This change isn't broken, though you could make use of any /sbin compat symlinks and not carry an upstream delta.
61-bcache.rules 2013-08-25 15:53:32.690312711 +0200 line 16
Quoted 5 lines
ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="bcache", \61-bcache.rules 2013-08-25 15:53:32.690312711 +0200 renamed from 61-bcache.rules.rules 2013-08-20 22:03:46.000000000 +0200 +1
-1- RUN+="bcache-register $tempnode" + RUN+="/usr/lib/udev/bcache-register $tempnode" LABEL="bcache_backing_end"
Unless there's been a change in udev, this change is unnecessary and introduces a distro-specific path.
Quoted 3 lines · Gabriel de Perthuis
Make path changes if you really need, but udev is supposed to find unqualified paths like bcache-register in $udevlibdir (
/lib/udevon debian, possibly/usr/lib/udevin fedora).
You're right; works fine without the full path.
Quoted 10 lines
Quoted 10 lines
This is the diff:
--- bcache-tools-20130820/61-bcache.rules.rules 2013-08-20
22:03:46.000000000 +0200
+++ bcache-tools-20130820/61-bcache.rules 2013-08-25
15:53:32.690312711 +020061-bcache.rules 2013-08-25 15:53:32.690312711 +0200 renamed from 61-bcache.rules.rules 2013-08-20 22:03:46.000000000 +0200 +0
-0@@ -5,14 +5,14 @@ ACTION=="remove", GOTO="bcache_end"
Quoted 8 lines
Quoted 7 lines
61-bcache.rules 2013-08-25 15:53:32.690312711 +0200 renamed from 61-bcache.rules.rules 2013-08-20 22:03:46.000000000 +0200 +2
-2# Backing devices: scan, symlink, register -IMPORT{program}="/sbin/blkid -o udev $tempnode" +#IMPORT{program}="/usr/sbin/blkid -o udev $tempnode" # blkid and probe-bcache can disagree, in which case don't register -ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end" +#ENV{ID_FS_TYPE}=="?*", ENV{ID_FS_TYPE}!="bcache",GOTO="bcache_backing_end"
Those first two changes should be reverted.
I tried, but with the blkid check first my /dev/bcache* devices are not reliably created. I have 2 in total (/dev/bcache0 and /dev/bcach1) and with the blkid there's only one after any reboot. Although the name varies (bcache0 or bcache1) it actually is always the /dev/bcache* device for the 'second' bcache device that is created. second one means: the first one is the combi of /dev/sda3 & /dev/sdb1, the second one is the combi of /dev/sdc1 and /dev/sdd1. I'm not sure how I can figure out what's actually happening during boot.
Quoted 5 lines
61-bcache.rules 2013-08-25 15:53:32.690312711 +0200 line 12
Quoted 3 lines
61-bcache.rules 2013-08-25 15:53:32.690312711 +0200 renamed from 61-bcache.rules.rules 2013-08-20 22:03:46.000000000 +0200 +1
-1-IMPORT{program}="/sbin/probe-bcache -o udev $tempnode" +IMPORT{program}="/usr/sbin/probe-bcache -o udev $tempnode"This change isn't broken, though you could make use of any /sbin compat symlinks and not carry an upstream delta.
Moved back to using the symlinks, though later on ...
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines
I tried, but with the blkid check first my
/dev/bcache*devices are not reliably created. I have 2 in total (/dev/bcache0and/dev/bcach1) and with the blkid there's only one after any reboot. Although the name varies (bcache0 or bcache1) it actually is always the/dev/bcache*device for the 'second' bcache device that is created. second one means: the first one is the combi of/dev/sda3&/dev/sdb1, the second one is the combi of/dev/sdc1and/dev/sdd1. I'm not sure how I can figure out what's actually happening during boot.
Possibly /dev/sdc1 or /dev/sdd1 has a stray non-bcache superblock.
You can check with wipefs, and remove it with wipefs -a.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines
Quoted 9 lines
I tried, but with the blkid check first my
/dev/bcache*devices are not reliably created. I have 2 in total (/dev/bcache0and/dev/bcach1) and with the blkid there's only one after any reboot. Although the name varies (bcache0 or bcache1) it actually is always the/dev/bcache*device for the 'second' bcache device that is created. second one means: the first one is the combi of/dev/sda3&/dev/sdb1, the second one is the combi of/dev/sdc1and/dev/sdd1. I'm not sure how I can figure out what's actually happening during boot.Possibly
/dev/sdc1or/dev/sdd1has a stray non-bcache superblock.
(I mean the other two, your "first" pair)
Quoted 1 line
You can check with wipefs, and remove it with wipefs -a.
Quoted 1 line · Gabriel de Perthuis
Possibly
/dev/sdc1or/dev/sdd1has a stray non-bcache superblock.
You're right, see below. That was an ugly one.
Do you think having blkid identify bcache itself would have helped, or is there always a chance of contradictive signatures which may confuse blkid?
Quoted 2 lines
You can check with wipefs, and remove it with wipefs -a.
The evidence:
[root@localhost ~]# wipefs /dev/sda3 [root@localhost ~]# wipefs /dev/sdb1
offset type
----------------------------------------------------------------0x218 LVM2_member [raid]
UUID: ZSSjZv-FU0H-Zeaa-92GU-37Zs-KyLS-JMF03Y
[root@localhost ~]# wipefs /dev/sdc1
[root@localhost ~]# wipefs /dev/sdd1
[root@localhost ~]# blkid /dev/sdb1/dev/sdb1: UUID="ZSSjZv-FU0H-Zeaa-92GU-37Zs-KyLS-JMF03Y" TYPE="LVM2_member" [root@localhost ~]#
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines
You're right, see below. That was an ugly one.
Do you think having blkid identify bcache itself would have helped, or is there always a chance of contradictive signatures which may confuse blkid?
make-bcache should use libblkid to detect existing superblocks, and bail and recommend wipefs.
Support in the other direction (having libblkid support bcache) is just a nice-to-have, and will maybe allow simplifying a few things in bcache-progs. The udev rule is written not to break if libblkid gets bcache support, but it can't really be simplified, we still want to detect stray superblocks even if the latest tools can't create them.