From: "Sergiusz Brzeziński" <Sergiusz.Brzezinski@supersystem.pl>
To: NeilBrown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: mdadm --monitor: need extra feature?
Date: Wed, 22 Aug 2012 11:50:17 +0200 [thread overview]
Message-ID: <5034AB59.90907@supersystem.pl> (raw)
In-Reply-To: <20120822174435.685d80d4@notabene.brown>
W dniu 22.08.2012 09:44, NeilBrown pisze:
[...]
>>> So, again, ignoring that you possibly should not be using RAID for a
>>> backup... how about using udev scripts to see when you plugin a drive,
>>> and that script can check the UUID against any md arrays, and if it
>>> matches, add it to the array....
>>
>> I wrote a script making this work. It runs once a hour. I pass the parameter
>> with md device to the script. It checks the state of the array with "mdadm
>> --detail". If there is something wrong (State : degraded) it reads UUID of that
>> array. Then it scans for /dev/sd* partitions and checks with "mdadm --examine"
>> if UUID matches. If so, the partition can be added with "mdadm --add". That is
>> why I asked abut this feature in mdadm - recognising if there is a new partition
>> belonging to monitored array. With mdadm this procedure would work on elegant
>> manner.
>>
>
> udev really is the right way to do this. Just get udev to run
> mdadm -I /dev/newdev
> whenever a device is discovered. It can then be automatically re-added
> depending on the policy set up in mdadm.conf.
> "mdadm --monitor" will not gain this functionality. It is for monitoring
> active arrays, not for monitor new devices.
>
> NeilBrown
>
Yes, that ist what I need and what I asked for!: udev + mdadm -I
I didn't know the Incremental function of mdadm (mea culpa). And udev is even
prepared for this! (at least in Ubuntu)
I never thougt it is so simple!
thank You
For another people looking for similar solution I write what I did:
1.
I switched /etc/udev/udev.conf/udev_log to "debug" to see what happen after
inserting new drive.
2.
After inserting the drive I found in logs following lines:
Aug 22 11:08:47 serwer-linmot udevd[2287]: '/sbin/mdadm --incremental
/dev/sdc3'(err) 'mdadm: not adding /dev/sdc3 to active array (without --run)
/dev/md/0'
Aug 22 11:08:47 serwer-linmot udevd[2287]: '/sbin/mdadm --incremental /dev/sdc3'
[2310] exit with return code 2
3.
In Ubuntu there is in /lib/udev/rules.d/64-md-raid.rules file responsible for
this. I only changed one line:
ACTION=="add", RUN+="/sbin/mdadm --incremental $tempnode"
to:
ACTION=="add", RUN+="/sbin/mdadm --incremental --run $tempnode"
And thats all!
Now, I don't have to use my script from crontab anymore. Raid start rebuilding
array immediately after disk is inserted.
Sergiusz
next prev parent reply other threads:[~2012-08-22 9:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 10:41 mdadm --monitor: need extra feature? Sergiusz Brzeziński
2012-08-21 10:44 ` David Brown
2012-08-21 11:51 ` Sergiusz Brzeziński
2012-08-21 12:39 ` Adam Goryachev
2012-08-22 7:14 ` Sergiusz Brzeziński
2012-08-22 7:44 ` NeilBrown
2012-08-22 9:50 ` Sergiusz Brzeziński [this message]
[not found] ` <5034B0A2.4080403@websitemanagers.com.au>
2012-08-22 10:50 ` Sergiusz Brzeziński
2012-08-22 10:57 ` Sergiusz Brzeziński
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5034AB59.90907@supersystem.pl \
--to=sergiusz.brzezinski@supersystem.pl \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.