I've been learning about RAID recently because I plan on using it in a NAS I'm going to build in the future. My problem isn't to do with the Pi itself, but you're all a smart and friendly bunch so I thought I'd ask here. To get some hands-on experience with RAID, I purchased 5 identical flash drives and plugged 4 into my Pi 3b+. 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 something that I did not expect right after my first experiment with level 0. When I try to set up the new array, the software RAID immediately begins "recovery" on them. This confuses the heck out of me because, what is it recovering? These are "new" disks in a "new" array, I don't expect any recovery to be happening. Moreover, the previous array was level 0, where data recovery is not possible.
On top of some general reading of RAID and the `mdadm` man page, I've been following these two articles as a guide:
how to create raid arrays with mdadm on ubutnu
how to manage raid arrays with mdadm
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 level 0 array, and set up the new level 5 array:
Back on the pi, 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. I deleted and got rid of the first level 0 array, I formatted the disks. My expectation is that mdadm should just create the new array and not attempt any 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 mdadm to create the virtual disk at `/dev/md1` instead of `/dev/md0`. This is my clue that I must have missed something but I don't know what. Can anyone point out where I went wrong?
On top of some general reading of RAID and the `mdadm` man page, I've been following these two articles as a guide:
how to create raid arrays with mdadm on ubutnu
how to manage raid arrays with mdadm
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 level 0 array, and set up the new level 5 array:
- unmount the filesystem
- stop the array
- remove the array
- erase the md superblock (`mdadm --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}`
Back on the pi, 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. I deleted and got rid of the first level 0 array, I formatted the disks. My expectation is that mdadm should just create the new array and not attempt any 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 mdadm to create the virtual disk at `/dev/md1` instead of `/dev/md0`. This is my clue that I must have missed something but I don't know what. Can anyone point out where I went wrong?
Statistics: Posted by maquinisto — Mon May 06, 2024 2:06 am — Replies 0 — Views 2