Re: How to automatically add a nbd to a raid1?
Peter Breuer <[email protected]> Mon, 15 Dec 2008 16:24:09 +0100 (CET)
| Newsgroups | gmane.linux.enbd.general |
|---|---|
| Message-ID | <[email protected]> |
"Also sprach Michael Rendell:"
> > That's kind of understandable. But the raid disks themselves contain
> > all the required info in their superblocks. Each will say what the
> > other members of the array are. You should be able to interrogate them
> > individually with mdadm --whatever and confirm my contention!
>
> While "mdadm --detail --verbose /dev/mdNN" doesn't list the removed
> devices,
It should .. morally, I mean. It KNOWS what devices are notionally in
the array.
> one can figure out where a new device should go by looking
> at the output of "mdadm --examine /dev/ndA" (match the UUID and raid level).
Yes, well UUIDs listed in the superblock plus a check on other disks
will indeed suffice to work it out, but I recall that the info is indeed
there .. just as a list of component device majors and minors. Have
another look .. if you don't find it I'll have a look too.
> Have had a look at the udev events by adding the line
> KERNEL=="nd[a-z]", SUBSYSTEM=="block", RUN+="/root/enbd-udev-watch"
Simpler to turn on udev debugging! It sends messages to syslog.
> to /etc/udev/rules.d/90-enbd.rules, where the /root/enbd-udev-watch
> script looks like:
> #!/bin/sh
>
> exec >> /tmp/enbd-udev-watch.log 2>&1
> echo
> echo "Run at " $(date)
> echo "Env {:"
> env | sed 's/^/ /';
> echo "}"
> echo
> It shows that ACTION=add events happen for all 16 /dev/nd[a-p] devices when
Sure. We know that .. that's already intercepted by the existing enbd
udev script. It's what's used by udev to make the device nodes in the
first place.
> the kernel module is loaded. As this is before the enbd-client is
> started (and before it gets the connection going), it isn't useful
> for this purpose.
Yes. But what you want is the ONLINE and OFFLINE notices that enbd
sends to udev, not the ADD.
The ADD and REMOVE events are just generated by the kernel disk
partition subsystem as the driver registers control of its majors and
minors. They're what udev rules send to the MAKEDEV and REMOVEDEV
scripts in the enbd distr, via the provided enbd.rules file.
Peter