I don’t think this problem is to do with Fedora specifically, but y’all and a smart and friendly bunch so I thought I’d try finding some help here. I’ve been learning about RAID recently because I plan on using it in a NAS I’m going to build in the future. To get some hands-on experience with it, I purchased 5 identical flash drives. My plan was to set them up and format them a few times so I could try out different RAID levels, and most importantly practice what to do in the event of a disk failure. I found that after deleting the first RAID array and creating a new array with a different level, the computer immediately begins “recovery” on the new array. I did not expect this because these are “new” disks in a new array, and the previous array level was 0, where there is not data recovery possible.
On top of some general reading of RAID and the mdadm
man page, I’ve been following these two articles as a guide:
My first experiment was to set up the flash drives in RAID level 0, which I did easily with no issue. I copied some data onto the array and everything worked as expected. The next step in my plan was to wipe all the drives clean, set them up with RAID level 5, then remove a disk to simulate a failure and plug in the 5th blank flash drive to practice recovering from the failure.
I followed these steps to delete the RAID 0 array, and set up the new level 5 array:
- unmount the filesystem
- stop the array (
mdadm
) - remove the array (
mdadm
) - erase the md superblock (
--zero-superblock
) on all the disks - confirm there are no references to the array in
/etc/fstab
and/etc/mdadm/mdadm.conf
- update initramfs
- format the disks with
fdisk --wipe
- create level 5 array:
sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 /dev/sd{a,b,c,d}
At this point I run cat /proc/mdstat
to check the array and to my surprise I find that it is in the middle of recovery. Recovering what? There’s nothing on these disks! I’m thinking I must’ve not cleared these disks properly and there must be some RAID data still on the partitions. I stop the array, remove the disks and bring them over to my laptop where I format them with gnome-disks and write 0’s to the whole disk. That’ll take care of it, I thought.
Back on my main desktop, I created the level 5 array and AGAIN, I find that it immediately begins attempting “recovery” on the disks! This makes no sense to me. My expectation is that mdadm
should just create the new array and there should be no attempt at recovery. I must be doing something wrong and I was hoping someone who knows more about RAID might be able to point out where I went off.
I did manage to get a level 5 array working as expected by telling I think this is a clue that I must have missed something but I don’t know what. Can anyone point out where I went wrong? Or maybe it’s normal for a recovery to sometimes be run on new arrays?mdadm
to create the virtual disk at /dev/md1
instead of /dev/md0
.
Scratch that, I just checked sudo mdadm -D /dev/md1
and found that it is actually somehow level 0, despite me passing --level=5
… Or maybe I just imagined I did. Man, I am confused.