[Yaird-devel] Bug#377801: HOWTO get yaird to work with partitionable md devices

Christian Pernegger pernegger at gmail.com
Tue Jul 11 11:15:41 UTC 2006


Package: yaird
Version: 0.0.12-14
Severity: normal


I trivially modified my local yaird to support partitionable md
devices of the form /dev/md_dNN as per mdamd man page:

1) Change the regexp identifying an md device

--- yaird-0.0.12.orig/perl/Plan.pm
+++ yaird-0.0.12/perl/Plan.pm
@@ -365,7 +365,7 @@

        my $name = $device->name;
        my $devno = $device->devno;
-       if ($name !~ /^md\d+$/) {
+       if ($name !~ /^md(_d)?\d+$/)  {
                return 0;
        }

--- yaird-0.0.12.orig/perl/ActiveBlockDev.pm
+++ yaird-0.0.12/perl/ActiveBlockDev.pm
@@ -170,7 +170,7 @@
                $self->{yspecial} = "/dev/$name";
        }
        elsif ($creator eq "mdadm") {
-               Base::assert ($name =~ /^md\d+$/);
+               Base::assert ($name =~ /^md(_d)\d+$/);
                $self->{yspecial} = "/dev/$name";
        }
        elsif ($creator eq "devmapper") {

2) Add dd by adding a

	FILE "/bin/dd"

line to the prologue section of /etc/yaird/Templates.cfg (see below)

3) Change the mdadm template in /etc/yaird/Templates.cfg to read

    TEMPLATE mdadm
        BEGIN
                FILE "/sbin/mdadm"
                SCRIPT "/init"
                BEGIN
                        !mknod <TMPL_VAR NAME=target> b <TMPL_VAR NAME=major> <TMPL_VAR NAME=minor>
                        !mdadm --assemble --config=partitions <TMPL_VAR NAME=target> --uuid <TMPL_VAR NAME=uuid>
                        !dd if=<TMPL_VAR NAME=target> of=/dev/zero count=1
                END SCRIPT
        END TEMPLATE

COMMENTS

- the mknod hack is actually necessary because it creates
  the right dev file for both partitionable and regular md
  devices with the same command, while mdadm's --auto option
  needs different arguments for each.

- after a partitionable array is assembled its dev file needs
  to be prodded, or else the partitions will not show up in
  sysfs. For regular md devices this could be skipped, but a
  check would just be added complexity.
  dd was the first thing that came to my mind but any read
  access will do.

- Maybe some kind of prodding should be done for all block
  devices in mksymdev, since IIRC all block devices need to
  be accessed before they appear in sysfs. Merely waiting
  for the sysfs file (as mksymdev does now) won't help.

- the UUID is enough to identify devices, and we don't need to
  list candidates, --config=partitions will do.

- --run is meant to override an user-input check that triggers
  when not enough devices are specified. If all we want is start
  degraded arrays, --config partitions will do that for us.

- the only glitch that I could not fix is that yaird drops to
  dash when one of the original component devices is missing, i. e.
  the array is degraded. Ctrl-D will continue the boot fine.

  (The Plan automatically generates an mkbdev for every dependant
  device, thus mknoding it. mdadm does not need the nodes, but we
  need to handle the component disks at initrd build time to pull
  any needed controller modules is. I have found no easy way to just
  pull the modules for a component device but ignore it at initrd
  run time.)

- I changed the /etc/yaird/Templates.cfg because I was not sure
  how the default for that was generated in the source. Ideally
  the Template.cfg change would "come with the package" of course.

Regards,

Christian


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17.4
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages yaird depends on:
ii  cpio                         2.6-15      GNU cpio -- a program to manage ar
ii  dash                         0.5.3-3     The Debian Almquist Shell
ii  libc6                        2.3.6-15    GNU C Library: Shared libraries
ii  libhtml-template-perl        2.8-1       HTML::Template : A module for usin
ii  libparse-recdescent-perl     1.94.free-3 Generates recursive-descent parser
ii  perl                         5.8.8-4     Larry Wall's Practical Extraction 

yaird recommends no packages.

-- no debconf information




More information about the Yaird-devel mailing list