* mdadm --fail requires writeable drive.
@ 2013-11-13 12:17 Benjamin ESTRABAUD
2013-11-14 0:44 ` NeilBrown
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin ESTRABAUD @ 2013-11-13 12:17 UTC (permalink / raw)
To: Linux-RAID
Hi,
I noticed that mdadm --fail will only work if a disk is present and is
writeable.
mdadm's Manage.c seems to first make sure the drive can be "stat"ed
before proceeding (which will fail if the drive is gone), and then
seemingly try to write "Faulty" to the drive's superblock as well as
notifying MD of the drive failure.
However, in many cases, a drive must be set faulty because it has gone
offline. MD will do a very good job to set the drive faulty itself,
provided that IOs are running on the array. If no IOs are running on the
array, removing a drive and then trying to set it as failed will not
work. Trying to "-r" the drive will also fail since the drive is not yet
marked as failed, so deemed still in use.
Looking through the code it seemed to me that MD could be told to fail a
drive even if that drive was no longer present (the /dev/sdX device node
file still is in this case), in the same way as remove works. Would that
be possible? Am I missing something here?
Thanks in advance for your help.
Regards,
Ben - MPSTOR
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mdadm --fail requires writeable drive.
2013-11-13 12:17 mdadm --fail requires writeable drive Benjamin ESTRABAUD
@ 2013-11-14 0:44 ` NeilBrown
2013-11-14 17:33 ` Benjamin ESTRABAUD
0 siblings, 1 reply; 5+ messages in thread
From: NeilBrown @ 2013-11-14 0:44 UTC (permalink / raw)
To: Benjamin ESTRABAUD; +Cc: Linux-RAID
[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]
On Wed, 13 Nov 2013 12:17:21 +0000 Benjamin ESTRABAUD <be@mpstor.com> wrote:
> Hi,
>
> I noticed that mdadm --fail will only work if a disk is present and is
> writeable.
>
> mdadm's Manage.c seems to first make sure the drive can be "stat"ed
> before proceeding (which will fail if the drive is gone), and then
> seemingly try to write "Faulty" to the drive's superblock as well as
> notifying MD of the drive failure.
>
> However, in many cases, a drive must be set faulty because it has gone
> offline. MD will do a very good job to set the drive faulty itself,
> provided that IOs are running on the array. If no IOs are running on the
> array, removing a drive and then trying to set it as failed will not
> work. Trying to "-r" the drive will also fail since the drive is not yet
> marked as failed, so deemed still in use.
>
> Looking through the code it seemed to me that MD could be told to fail a
> drive even if that drive was no longer present (the /dev/sdX device node
> file still is in this case), in the same way as remove works. Would that
> be possible? Am I missing something here?
Does
mdadm /dev/mdXX --fail detached
do what you want?
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mdadm --fail requires writeable drive.
2013-11-14 0:44 ` NeilBrown
@ 2013-11-14 17:33 ` Benjamin ESTRABAUD
2013-11-15 4:46 ` NeilBrown
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin ESTRABAUD @ 2013-11-14 17:33 UTC (permalink / raw)
To: NeilBrown; +Cc: Linux-RAID
Hi Neil,
This does work but I was looking for a way to explicitely set a
particular device as Failed (I want to process devices one by one).
But right now I was reading from the array to force it detecting the
failure as opposed to using "detached" which orders of magnitude better.
Thanks for the tip, I'll use that for now.
Regards,
Ben.
On 14/11/13 00:44, NeilBrown wrote:
> On Wed, 13 Nov 2013 12:17:21 +0000 Benjamin ESTRABAUD <be@mpstor.com> wrote:
>
>> Hi,
>>
>> I noticed that mdadm --fail will only work if a disk is present and is
>> writeable.
>>
>> mdadm's Manage.c seems to first make sure the drive can be "stat"ed
>> before proceeding (which will fail if the drive is gone), and then
>> seemingly try to write "Faulty" to the drive's superblock as well as
>> notifying MD of the drive failure.
>>
>> However, in many cases, a drive must be set faulty because it has gone
>> offline. MD will do a very good job to set the drive faulty itself,
>> provided that IOs are running on the array. If no IOs are running on the
>> array, removing a drive and then trying to set it as failed will not
>> work. Trying to "-r" the drive will also fail since the drive is not yet
>> marked as failed, so deemed still in use.
>>
>> Looking through the code it seemed to me that MD could be told to fail a
>> drive even if that drive was no longer present (the /dev/sdX device node
>> file still is in this case), in the same way as remove works. Would that
>> be possible? Am I missing something here?
>
> Does
> mdadm /dev/mdXX --fail detached
>
> do what you want?
>
> NeilBrown
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mdadm --fail requires writeable drive.
2013-11-14 17:33 ` Benjamin ESTRABAUD
@ 2013-11-15 4:46 ` NeilBrown
2013-11-15 12:22 ` Benjamin ESTRABAUD
0 siblings, 1 reply; 5+ messages in thread
From: NeilBrown @ 2013-11-15 4:46 UTC (permalink / raw)
To: Benjamin ESTRABAUD; +Cc: Linux-RAID
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
On Thu, 14 Nov 2013 17:33:01 +0000 Benjamin ESTRABAUD <be@mpstor.com> wrote:
> Hi Neil,
>
> This does work but I was looking for a way to explicitely set a
> particular device as Failed (I want to process devices one by one).
>
> But right now I was reading from the array to force it detecting the
> failure as opposed to using "detached" which orders of magnitude better.
>
> Thanks for the tip, I'll use that for now.
If you really want to just fail one of them you can used the "kernel name"
like "sda1".
If you
ls -d /sys/block/mdXX/md/dev-*
you will see the devices that are though to be part of the array. The part
of the name after "dev-" is the "kernel name".
"mdadm /dev/mdXX --fail" will accept a "kernel name" and will mark just that
device as faulty.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mdadm --fail requires writeable drive.
2013-11-15 4:46 ` NeilBrown
@ 2013-11-15 12:22 ` Benjamin ESTRABAUD
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin ESTRABAUD @ 2013-11-15 12:22 UTC (permalink / raw)
To: NeilBrown; +Cc: Linux-RAID
On 15/11/13 04:46, NeilBrown wrote:
> On Thu, 14 Nov 2013 17:33:01 +0000 Benjamin ESTRABAUD <be@mpstor.com> wrote:
>
>> Hi Neil,
>>
>> This does work but I was looking for a way to explicitely set a
>> particular device as Failed (I want to process devices one by one).
>>
>> But right now I was reading from the array to force it detecting the
>> failure as opposed to using "detached" which orders of magnitude better.
>>
>> Thanks for the tip, I'll use that for now.
>
Hi Neil,
> If you really want to just fail one of them you can used the "kernel name"
> like "sda1".
> If you
> ls -d /sys/block/mdXX/md/dev-*
>
Thanks a lot for this! This is exactly what I was looking for and it
worked like a charm.
> you will see the devices that are though to be part of the array. The part
> of the name after "dev-" is the "kernel name".
> "mdadm /dev/mdXX --fail" will accept a "kernel name" and will mark just that
> device as faulty.
>
That's perfect. Thanks a lot!
> NeilBrown
>
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-15 12:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 12:17 mdadm --fail requires writeable drive Benjamin ESTRABAUD
2013-11-14 0:44 ` NeilBrown
2013-11-14 17:33 ` Benjamin ESTRABAUD
2013-11-15 4:46 ` NeilBrown
2013-11-15 12:22 ` Benjamin ESTRABAUD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).