What happens when you remove a drive from linux raid?

0

I have a home media server that gave me a message today saying one of the drives is soon to fail (not happy, still under warranty, that's another issue)

I am running Mdadm raid 0 on a 3 drive system 4TB each.

I've got just enough space that I could remove the drive and still have some space left.

If I simply remove the drive from the array, will the data on it get moved to the other drives, or is just "lost"?

Since I have enough space on the remaining 2 drives, is it possible to "shrink" the array by 1 partition, and then remove it?

JonYork

Posted 2018-04-20T15:14:46.463

Reputation: 153

You can't shrink a RAID0 array this way. (Indeed hindsite is a wonderful thing - using LVM would provide most of the benefits of RAID0, but allow you to do just this) – davidgo – 2018-04-20T19:10:11.657

Answers

4

RAID 0 will implode as soon as a single disk fails, as the data is spread across the disks, regardless of the size the the partition/volume in comparison to the array (a volume that's 1/10th the size of the array is still spread across disks). No data will be automatically moved anywhere. Make a backup of the volume to a secondary data device, blow away the array, remove the drive, recreate the array as wanted, restore data.

Ƭᴇcʜιᴇ007

Posted 2018-04-20T15:14:46.463

Reputation: 103 763

so If I understand correctly, I can remove the drive, DD block copy it to a new drive, bring the new drive in and start the array once more? – JonYork – 2018-04-20T15:23:18.067

If DD copies all the RAID header information on the drive (like does a true block-by-block copy) then it will probably* work, but I wouldn't' bet on it (without a full backup first). ;) – Ƭᴇcʜιᴇ007 – 2018-04-20T15:26:12.037

Raid 0 is really a performance-only RAID and you should treat one failing drive as if you have one single hard drive and it's failing. Your smart move right now is to back up the contents of the array onto an external form of media. – CDove – 2018-04-20T15:42:24.330

@techie007 I don't, and will probably never use RAID0 - but assuming the old drive is still working (and not going offline) would you be able to add a new disk, then migrate the old disk to the new one using mdadm /dev/mdX --add /dev/sdX1 --replace /dev/sdY1 --with /dev/sdYX – davidgo – 2018-04-20T19:07:16.753

@davidgo would that be a one liner that would transfer the data to the new drive? – JonYork – 2018-04-20T20:10:10.060

Yes, in theory. No idea if it works though. You really don't want to use RAID0 - even JBOD is better except for an extremely narrow use case. (Big contiguous files, high speed required, can't afford to spend anything and don't value data at all - maybe editing large videos?) – davidgo – 2018-04-20T20:17:08.557

-1

since its raid 0 it doesn't have any back up I recommend writing a back up to another drive before doing anything and change the raid to a raid 10 it does have redundancy so at that point you can remove a drive and put a new one in and it will re write the info to the new drive. You do need 4 drives for raid 10 but I think it might be the answer for you because it provides the bonus performance while giving you a mirrored setup... with this set up you should even be able to hotswap 1 drive or any 1 drive could fail any you would have no issues.

check this out it has a bit more info on RAID: https://www.prepressure.com/library/technology/raid

Just Curious

Posted 2018-04-20T15:14:46.463

Reputation: 1

I did not down voted you, but I imagine the person who did did do because you recommended RAID5. RAID5 is a pretty much dead technology because it can't reliably handle large disks when there is a failure (the chance of a second disk failure during rebuild is hugh and rebuilds are very low) – davidgo – 2018-04-20T18:56:55.960

Ah ... honestly didn't know that about Raid 5 honestly I recommend 10 because you get performance and mirror. Never understood why people would use 5 over 10 when you had to have the same amount of drives anyway XD ... thx for the info – Just Curious – 2018-04-20T19:00:05.943

In addition to the fact RAID 5 is bad advice, this reads more like a comment, and you not being sure of what you recommended doesn’t help. You also link to some random website but don’t even bother quoting anything from it. – Ramhound – 2018-04-21T00:30:09.480