Bug#605824: initramfs-tools: mkinitramfs fails to derrive root block device on partitioned MD RAID (/dev/md1p3 -> /sys/block/md1/md1p3)
On Sat, 04 Dec 2010, Cestmir Hybl wrote:
> attaching output of:
> tree /sys/block
> tree /sys/devices/virtual/block/md1
>
> ch.
>
could you please test the following patch, on a running system it applies
to /usr/share/initramfs-tools/hook-functions:
cd /usr/share/initramfs-tools/
sudo patch -p1 </tmp/0001-MODULES-dep-Fix-partitioned-raid-setup.patch
patching file hook-functions
Hunk #1 succeeded at 297 (offset -2 lines).
thank you.
--
maks
>From 282dbd8ad5bbfe5f8f7182dc090bbdfd0adb07ec Mon Sep 17 00:00:00 2001
From: maximilian attems <max@stro.at>
Date: Sun, 5 Dec 2010 10:12:43 +0100
Subject: [PATCH] MODULES=dep Fix partitioned raid setup
Specific setup has md0: unpartitioned RAID1 with /boot;
md1: partitioned RAID10f2 with root fs on /dev/md1p3
/sys walk needs to ignore the partition to derive the needed modules.
Closes: #605824
Signed-off-by: maximilian attems <max@stro.at>
---
hook-functions | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/hook-functions b/hook-functions
index c35808c..55911e5 100644
--- a/hook-functions
+++ b/hook-functions
@@ -299,12 +299,16 @@ dep_add_modules()
# md root new naming scheme /dev/md/X
elif [ "${root#/dev/md/}" != "${root}" ]; then
root=${root#/dev/md/}
+ # strip partion number
+ root=${root%p[0-9]}
# drop the partition number only for sdX and hdX devices
# and keep it for other devices like loop#, dm-# devices
block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^md'$root' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p' </proc/mdstat)
# md root /dev/mdX
elif [ "${root#/dev/md}" != "${root}" ]; then
root=${root#/dev/md}
+ # strip partion number
+ root=${root%p[0-9]}
# drop the partition number only for sdX and hdX devices
# and keep it for other devices like loop#, dm-# devices
block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^md'$root' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p' </proc/mdstat)
--
1.7.2.3
Reply to: