Bug#381057: make mdadm use homehost for initramfs

martin f krafft madduck at madduck.net
Tue Aug 1 18:51:44 UTC 2006


Package: mdadm
Version: 2.5.2-9
Severity: wishlist

Documenting this possible future change, which came up during the
discussion about mdassemble, which is lighter than mdadm and could
thus be used during boot, or in the udeb.

----- Forwarded message from Neil Brown <neilb at suse.de> -----

> I had another question about mdassemble... it requires mdadm.conf,
> right? I currently just create that file during boot because of
> http://bugs.debian.org/284022 -- is there a better way you suggest?
> I could just copy the file into the initramfs from the host, but
> then maybe there have been changes made to the RAID configuration
> without /etc/mdadm/mdadm.conf being updated, and noone noticed
> because everything continued to work because of the initramfs...

Yes, mdassemble and mdadm --assemble require mdadm.conf.
It is needed to identify the arrays to be assembled.
This may seem to make it difficult to just "Assemble all arrays that
you can find", but that is very deliberate.  I think doing that is the
wrong thing to do.  It can get confused when moving drives from one
machine to another.

To address this issue I wrote the 'homehost' stuff.
Check the man page for details.
The idea is that all arrays belonging to a particular host are tagged
with the host's name, and then they can be found and assembled
reliably.

So:
  in mdadm.conf put
      CREATE homehost=<system>
  (literally) and every array created with be tagged with the hostname 
  from gethostname(2).

  In initrd, put
	mdadm --assemble --scan --homehost='<system>' --auto=yes --auto-update-homehost

  and make sure the hostname is set at this point (that might be the
  tricky bit).
  Then mdadm will scan all devices for md array components that are
  tagged for this host and will assemble them all (without a config
  file).
  If it doesn't find any arrays, then the --auto-update-homehost thing
  comes into play.
  It will rescan all devices looking for any md - nomatter what host
  it is tagged for - and will rewrite the superblocks to be for 'this'
  host and will assemble them.

  On subsequent boots it will find some arrays tagged for this host
  and will assemble them and so will NOT do the auto-update thing.
  That only happens when NO md arrays for this host are found.

The net result should be pretty much what everyone seems to want, but
with enough caution to make me happy.

The tricky bit, as I said, is making sure the host name is available
to the initramfs.

NeilBrown

----- End forwarded message -----

Making the hostname available to the initramfs is as easy as adding
a line to the hook.

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net at madduck
 
spamtraps: madduck.bogus at madduck.net
 
... and don't get caught in the .NET!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature (GPG/PGP)
Url : http://lists.alioth.debian.org/pipermail/pkg-mdadm-devel/attachments/20060801/25c1f7d8/attachment.pgp


More information about the pkg-mdadm-devel mailing list