On Sat, May 21, 2005 at 05:35:48PM +0200, martin f krafft wrote:
> -         echo "Starting raid devices: "
> +      if [ -d /dev/.udevdb -a ! -e /dev/md0 -a ! -e /dev/md/0 ]; then
> +        echo -n "Creating raid device nodes: "
> +        cd /dev && WRITE_ON_UDEV=1 ./MAKEDEV md
> +        echo "done."
> +      fi
> +      echo -n "Starting raid devices: "

I suspect this will not work if /dev/md0 is activated by the initrd,
and the user wants to mount /dev/md7 which is not touched by initrd.
At the moment, I can't test suspicion, so please feel free to ignore the
following ramblings if testers are happy.

Mdadm is of course perfectly capable of creating it's own /dev/md0,
provided auto=md is given for the relevant device in /etc/mdadm/mdadm.conf.

The problem is that users are not aware that this configuration option
exists, giving rise to repeated bug reports, so you want to create the
device regardless of config setting.

Mdadm provides the --auto commandline option for that, but it turns out
that the absense of auto=md in the config file overrules the command line,
so it's useless in practice.

The attached patch changes this, so that --auto works regardless of command
line settings, like so:

        # rm /dev/md0
        rm: cannot remove `/dev/md0': No such file or directory
        # cat /etc/mdadm/mdadm.conf
        DEVICE partitions
        ARRAY /dev/md0 level=raid1 num-devices=2 
UUID=85318365:3b91c827:faee55c7:b1d96199
        # /sbin/mdadm -A -s -a
        mdadm: error opening /dev/md0: No such file or directory
        # ./mdadm -A -s -a
        mdadm: /dev/md0 has been started with 2 drives.
        # ls -l /dev/md0
        brw-------  1 root root 9, 0 2005-05-21 19:06 /dev/md0
        #

With this modification, you no longer need the tests for /dev/.udevdb etc,
and can simply say $MDADM -A -s -a in /etc/init.d/mdadm-raid.

Regards,
Erik


--- mdadm-1.9.0/mdadm.c 2005-05-21 18:48:49.000000000 +0200
+++ mdadm-1.9.0-hack/mdadm.c    2005-05-21 18:45:04.000000000 +0200
@@ -732,7 +732,7 @@
                                        devlist->devname);
                                rv |= 1;
                        } else {
-                               mdfd = open_mddev(devlist->devname, 
array_ident->autof);
+                               mdfd = open_mddev(devlist->devname, (autof ? 
autof : array_ident->autof));
                                if (mdfd < 0)
                                        rv |= 1;
                                else {
@@ -759,7 +759,7 @@
                                        rv |= 1;
                                        continue;
                                }
-                               mdfd = open_mddev(dv->devname, 
array_ident->autof);
+                               mdfd = open_mddev(dv->devname, (autof ? autof : 
array_ident->autof));
                                if (mdfd < 0) {
                                        rv |= 1;
                                        continue;
@@ -777,7 +777,7 @@
                        } else
                                for (; array_list; array_list = 
array_list->next) {
                                        mdu_array_info_t array;
-                                       mdfd = open_mddev(array_list->devname, 
array_list->autof);
+                                       mdfd = open_mddev(array_list->devname, 
(autof ? autof : array_list->autof));
                                        if (mdfd < 0) {
                                                rv |= 1;
                                                continue;


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to