Skip to contentSkip to conversation

Give --persistent_policy precedence over /dev/mapper names

RFC/PATCH Martin Wilck 2 participants 4 messages Oct 5, 2016 – Oct 27, 2016 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

There is currently no way to override dracut's preference for /dev/mapper device names. But using these is problematic in different scenarios: For example, if a user has a multipath- enabled system but wants to disable multipath, or if the names of multipath maps change because of configuration changes (e.g. toggling user_friendly_names in /etc/multipath.conf).

This patch makes dracut prefer the user-specified
--persistent_policy names over /dev/mapper names.

It might be worthwhile to discuss why dracut prefers /dev/mapper of /dev/disk/by-uuid at all. This preference was introduced in 9037b63e with the argument "dm devices maintain /dev/mapper/* as persistent names", but that's wrong for the scenarios mentioned above, and is not a compelling reason for preferring /dev/mapper over /dev/disk/by-uuid.

---
 dracut-functions.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
dracut-functions.sh +8 -2
index 249d8fb..e97765d 100755
@@ -223,14 +223,20 @@ get_devpath_block() {
 
 # get a persistent path from a device
 get_persistent_dev() {
-    local i _tmp _dev
+    local i _tmp _dev _pol
 
     _dev=$(get_maj_min "$1")
     [ -z "$_dev" ] && return
 
+    if [[ -n "$persistent_policy" ]]; then
+	_pol="/dev/disk/${persistent_policy}/*"
+    else
+	_pol=
+    fi
+
     for i in \
+        $_pol \
         /dev/mapper/* \
-        /dev/disk/${persistent_policy:-by-uuid}/* \
         /dev/disk/by-uuid/* \
         /dev/disk/by-label/* \
         /dev/disk/by-partuuid/* \
Signature · 1 line
2.10.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 10 lines · Martin Wilck

There is currently no way to override dracut's preference for /dev/mapper device names. But using these is problematic in different scenarios: For example, if a user has a multipath- enabled system but wants to disable multipath, or if the names of multipath maps change because of configuration changes (e.g. toggling user_friendly_names in /etc/multipath.conf).

This patch makes dracut prefer the user-specified
--persistent_policy names over /dev/mapper names.

Quoted 6 lines

It might be worthwhile to discuss why dracut prefers /dev/mapper of /dev/disk/by-uuid at all. This preference was introduced in 9037b63e with the argument "dm devices maintain /dev/mapper/* as persistent names", but that's wrong for the scenarios mentioned above, and is not a compelling reason for preferring /dev/mapper over /dev/disk/by-uuid.

Ping - does nobody have an opinion on this suggestion?

Regards
Martin

#3 lore raw
In reply to a message not in the archive
Quoted 40 lines · Martin Wilck

There is currently no way to override dracut's preference for /dev/mapper device names. But using these is problematic in different scenarios: For example, if a user has a multipath- enabled system but wants to disable multipath, or if the names of multipath maps change because of configuration changes (e.g. toggling user_friendly_names in /etc/multipath.conf).

This patch makes dracut prefer the user-specified
--persistent_policy names over /dev/mapper names.

It might be worthwhile to discuss why dracut prefers /dev/mapper of /dev/disk/by-uuid at all. This preference was introduced in 9037b63e with the argument "dm devices maintain /dev/mapper/* as persistent names", but that's wrong for the scenarios mentioned above, and is not a compelling reason for preferring /dev/mapper over /dev/disk/by-uuid.

---
 dracut-functions.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
dracut-functions.sh +4 -1
index 249d8fb..e97765d 100755
@@ -223,14 +223,20 @@ get_devpath_block() {
 
 # get a persistent path from a device
 get_persistent_dev() {
-    local i _tmp _dev
+    local i _tmp _dev _pol
 
     _dev=$(get_maj_min "$1")
     [ -z "$_dev" ] && return
 
+    if [[ -n "$persistent_policy" ]]; then
+	_pol="/dev/disk/${persistent_policy}/*"
+    else

dracut-functions.sh get_devpath_block() { · line 242

Quoted 10 lines
dracut-functions.sh +4 -1
+	_pol=
+    fi
+
     for i in \
+        $_pol \
         /dev/mapper/* \
-        /dev/disk/${persistent_policy:-by-uuid}/* \
         /dev/disk/by-uuid/* \
         /dev/disk/by-label/* \
         /dev/disk/by-partuuid/* \

looks good to me.
I would even do:
<https://github.com/dracutdevs/dracut/pull/166/files>
in PR
<https://github.com/dracutdevs/dracut/pull/166>

Which lets us set persistent_policy to something like:
persistent_policy="mapper by-uuid by-label" or
persistent_policy=(by-label by-id by-path by-partuuid)

What do you think?

A message that is not in the archive (sent off-list or not yet received): e8384369-a93f-63b1-9422-21c9d5bce657-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#5 lore raw

Hello Harald,

thanks for your reply.

Quoted 19 lines · Harald Hoyer
Quoted 18 lines · Martin Wilck

There is currently no way to override dracut's preference for /dev/mapper device names. But using these is problematic in different scenarios: For example, if a user has a multipath- enabled system but wants to disable multipath, or if the names of multipath maps change because of configuration changes (e.g. toggling user_friendly_names in /etc/multipath.conf).

This patch makes dracut prefer the user-specified
--persistent_policy names over /dev/mapper names.

It might be worthwhile to discuss why dracut prefers /dev/mapper of /dev/disk/by-uuid at all. This preference was introduced in 9037b63e with the argument "dm devices maintain /dev/mapper/* as persistent names", but that's wrong for the scenarios mentioned above, and is not a compelling reason for preferring /dev/mapper over /dev/disk/by-uuid.

[...]

Quoted 7 lines

looks good to me.
I would even do:
<https://github.com/dracutdevs/dracut/pull/166/files>
in PR
<https://github.com/dracutdevs/dracut/pull/166>

Quoted 6 lines

Which lets us set persistent_policy to something like:
persistent_policy="mapper by-uuid by-label" or
persistent_policy=(by-label by-id by-path by-partuuid)

What do you think?

That patch needs a fix, because /dev/disk/mapper doesn't exist. I commented on github.

IMO, being able to override only the first choice would be sufficient for almost every use case. But of course it doesn't hurt to have the option to customize more, either ... I'm uncertain.

I'd rather like to discuss the default again, which your patch leaves at "mapper". As I argued before, I think "by-uuid" would be the better choice. The awareness level for the "persistent_policy" option is low among users, few people are likely to use it. The default should be such that only the strangest setups out there should create a need to change it.

Thus I'd like to know why "mapper" should continue to be favored over UUID-based policy in the future. The obvious advantage of the UUID- based approach for multipath setups is that it enables booting even if multipathd fails or refuses to set up the map (think of a setup using the "find_multipaths" option, where only a single path is up during boot).

Best Regards,
Martin