martin f. krafft: check for running devices based on UUID

Martin F. Krafft madduck at alioth.debian.org
Fri Jan 29 06:19:58 UTC 2010


Module: mdadm
Branch: master
Commit: a82f419df02a4dacf4046cbee9dfb48ccbeaab11
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=a82f419df02a4dacf4046cbee9dfb48ccbeaab11

Author: martin f. krafft <madduck at debian.org>
Date:   Fri Jan 29 18:01:01 2010 +1300

check for running devices based on UUID

Signed-off-by: martin f. krafft <madduck at debian.org>

---

 debian/changelog      |    2 ++
 debian/initramfs/hook |   16 +++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2dafcaf..6cd1eb8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ mdadm (3.1.1-2) UNRELEASED; urgency=low
   * Ignore lintian error about not stopping in runlevel 1.
   * Include more information about the configuration, initrd, and LVM in
     bugscript output.
+  * Check active devices against configuration file based on UUID, not device
+    name.
 
  -- martin f. krafft <madduck at debian.org>  Wed, 27 Jan 2010 14:42:16 +1300
 
diff --git a/debian/initramfs/hook b/debian/initramfs/hook
index d4a6237..9b73055 100644
--- a/debian/initramfs/hook
+++ b/debian/initramfs/hook
@@ -226,13 +226,15 @@ if [ "$INITRDSTART" != none ] && [ -n "$devpairs" ]; then
     esac
   done
 
-  # see if /etc/mdadm/mdadm.conf looks like it's missing devices
-  $MDADM --detail --scan | while read array device rubbish; do
-    if ! echo $devpairs | grep -qw $device; then
-      warn "You appear to be missing $device from /etc/mdadm/mdadm.conf !"
-      warn "If this array is required to boot, you must add the following line:"
-      rubbish=`echo $rubbish | sed 's/metadata=[^ ]* //'`
-      warn "$array $device $rubbish"
+  # make sure the configuration file knows about all running devices
+  $MDADM --detail --scan | while read array device params; do
+    uuid=${params#*UUID=}; uuid=${uuid%% *}
+    if ! grep -q "UUID=$uuid" $DESTMDADMCONF; then
+      warn "the array $device with UUID $uuid"
+      warn "is currently active, but it is not listed in mdadm.conf. if"
+      warn "it is needed for boot, then YOUR SYSTEM IS NOW UNBOOTABLE!"
+      warn "please inspect the output of /usr/share/mdadm/mkconf, compare"
+      warn "it to $CONFIG, and make the necessary changes."
     fi
   done
 




More information about the pkg-mdadm-commits mailing list