Skip to content

Commit bf56cf3

Browse files
committed
feature/mdadm: Guess modules for raid components
If the RAID is built on NVMe, then modules for the NVMe subsystem must also be checked and added. The sysfs contains information about these components. As component devices are added to an md array, they appear in the `md` directory as new directories named `dev-XXX` where `XXX` is a name that the kernel knows for the device, e.g. hdb1. Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/md.rst:470 Signed-off-by: Alexey Gladkov <[email protected]>
1 parent c1cff5a commit bf56cf3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

features/mdadm/guess/device

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -efu
1+
#!/bin/bash -eu
22
# SPDX-License-Identifier: GPL-3.0-or-later
33

44
[ -d "$SYSFS_PATH$1"/md ] ||
@@ -22,6 +22,21 @@ if [ "${metadata_ver:0:9}" = 'external:' ]; then
2222
[ "$container_ver" = 'external:imsm' ] && mod_names+=(efivarfs)
2323
fi
2424

25+
#
26+
# As component devices are added to an md array, they appear in the ``md``
27+
# directory as new directories named::
28+
#
29+
# dev-XXX
30+
#
31+
# where ``XXX`` is a name that the kernel knows for the device, e.g. hdb1.
32+
#
33+
# https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/md.rst:470
34+
#
35+
for d in "$SYSFS_PATH$1"/md/dev-*; do
36+
[ ! -e "$d/block" ] ||
37+
guess_device "${d#$SYSFS_PATH}/block"
38+
done
39+
2540
if [ -n "${RESOLVE_MODALIAS-}" ]; then
2641
depinfo \
2742
--set-version="$KERNEL" \

0 commit comments

Comments
 (0)