I had a three-disk RAID 0 array and ran the following to add a fourth disk:
mdadm --manage /dev/md127 --add /dev/xvdi
Each disk is a 1TB EC2 volume. The array took about 40 hours to reshape. About 1 hour through, reshaping stopped and the volume became inaccessible. I restarted the machine and reshaping continued then finished seemingly successfully, but the array level is now reported as RAID 4 and the useable capacity hasn't changed.
mdadm --detail /dev/md127
now reports the following:
/dev/md127:
Version : 1.2
Creation Time : Wed Jul 1 22:26:36 2015
Raid Level : raid4
Array Size : 4294965248 (4096.00 GiB 4398.04 GB)
Used Dev Size : 1073741312 (1024.00 GiB 1099.51 GB)
Raid Devices : 5
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Sun Oct 11 07:40:48 2015
State : clean, degraded
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Chunk Size : 512K
Name : [removed]
UUID : [removed]
Events : 63530
Number Major Minor RaidDevice State
0 202 160 0 active sync /dev/xvdk
1 202 144 1 active sync /dev/xvdj
2 202 80 2 active sync /dev/xvdf
4 202 128 3 active sync /dev/xvdi
4 0 0 4 removed
My aim here is to have a 4TB RAID 0 array. I don't need redundancy since I backup by taking volume snapshots in AWS. I'm running Ubuntu Server 14.04.3.
How do I switch to RAID 0, without losing any data, taking into account the fact that the state is clean, degraded
?
Best Answer
You can change the current configuration directly to a RAID with
mdadm -G -l 0 /dev/md127
. Since a RAID 4 with only 4 of 5 members is essentially a RAID 0 without a parity stripe, the conversion will occur instantly. If there was a parity member, it would be dropped, but since it's already listed as "Removed", it will simply be dropped, Raid Devices decremented to 4, and state should be "clean".From the mdadm query printed above, you can see that the member size is 1TB and the volume size is 4TB, so the volume should be usable as is, even without the parity member. You will then need to grow the partition with parted and perform filesystem resize operations per usual.