Re: How to handle a RAID5 arrawy with a failing drive?

Chris Murphy
2014-03-17T05:12:45Z

On Mar 16, 2014, at 9:44 PM, Marc MERLIN <marc@merlins.org> wrote:

> On Sun, Mar 16, 2014 at 08:56:35PM -0600, Chris Murphy wrote:
>
>>> If I add a device, isn't it going to grow my raid to make it bigger instead
>>> of trying to replace the bad device?
>>
>> Yes if it's successful. No if it fails which is the problem I'm having.
>
> That's where I don't follow you.
> You just agreed that it will grow my raid.
> So right now it's 4.5TB with 10 drives, if I add one drive, it will grow to
> 5TB with 11 drives.
> How does that help?

If you swap the faulty drive for a good drive, I'm thinking then you'll be able to device delete the bad device, which ought to be "missing" at that point; or if that fails you should be able to do a balance, and then be able to device delete the faulty drive.

The problem I'm having is that when I detach one device out of a 3 device raid5, btrfs fi show doesn't list it as missing. It's listed without the /dev/sdd designation it had when attached, but now it's just blank.

> Why would btrfs allow me to remove the faulty device since it does not let
> you remove a device from a running raid. If I grow it to a bigger raid, it
> still won't let me remove the device, will it?

Maybe not, but it seems like it ought to let you balance, which should only be across available devices at which point you should be able to device delete the bad one. That's assuming you've physically detached the faulty device from the start though.

>
>>> In swraid5, if I add a device, it will grow the raid, unless the array is
>>> running in degraded mode.
>>> However, I can't see if btrfs tools know it's in degraded mode or not.
>>
>> Only once the device is missing, apparently, and then mounted -o degraded.
>
> Dully noted.
> If you agree that adding an 11th drive to my array will not help, I'll
> unmount the filesystem, remount it in degraded mode with 9 drives and try to
> add the new 11th drive.

That's the only option I see at the moment in any case, other than blowing it all away and starting from scratch. What I don't know is whether you will be able to 'btrfs device delete' what ought to now be a missing device, since you have enough drives added to proceed with that deletion; or if you'll have to balance first. And I don't even know if the balance will work and then let you device delete if it's a dead end at this point.

>
>>> If you are sure adding a device won't grow my raid, I'll give it a shot.
>>
>> No I'm not sure. And yes I suspect it will make it bigger. But so far a.) replace isn't supported yet; and b.) delete causes the volume to go below the minimum required for normal operation which it won't allow; which leaves c.) add a device but I'm getting a hang. So I'm stuck at this point.
>
> Right. So I think we also agree that adding a device to the running
> filesystem is not what I want to do since it'll grow it and do nothing to
> let me remove he faulty one.

The grow is entirely beside the point. You definitely can't btrfs replace, or btrfs device delete, so what else is there but try btrfs device add, or obliterate it and start over?

Chris Murphy