How to properly create a RAID 0 with MDADM

Some places create the raid and some places say I should format the drives first. So I better ask for official way as of today on how to create a RAID 0 array for internal drive for storing files out of the root system drive. I think /run/media/ is the place for disk I could remove in the future. And I want to put it on /etc/fstab for auto mount on boot. Is it OK to follow the Arch wiki on Manjaro or do I need something more or less?

That’s generally recommended, yes.

Yeah I was just worried it may be out of date though

Yes, it’s typically fine.

Though I’ve never setup RAID, the Arch Wiki article and another I just found seem to have it covered. If you get stuck, I’m sure someone will be able to help if needed.

1 Like

About that I wouldn’t know.

But I suspect the software will inform you if something’s afoot.

1 Like

True! I just encountered that the RAID wasn’t persisting after reboot so I was consulting everywhere about it.

It doesn’t, and it disappears after reboot. The RAID 0 is Filex

NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda           8:0    0   2.7T  0 disk  /run/media/bkp
sdb           8:16   0 465.8G  0 disk  
└─md0         9:0    0 931.3G  0 raid0 /run/media/filex
sdc           8:32   0   2.7T  0 disk  
sdd           8:48   0 465.8G  0 disk  
└─md0         9:0    0 931.3G  0 raid0 /run/media/filex
sde           8:64   1   239G  0 disk  
├─sde1        8:65   1   4.2G  0 part  
└─sde2        8:66   1     4M  0 part  
sr0          11:0    1  1024M  0 rom   
nvme0n1     259:0    0 953.9G  0 disk  
├─nvme0n1p1 259:1    0   300M  0 part  /boot/efi
└─nvme0n1p2 259:2    0 953.6G  0 part  /

You might like to search for your previous misadventures, to see what you did then. Here’s one I found from 2020;

I think it might be the mount point. As far as I know, /run isn’t persistent.

1 Like

Oooooo, I think I missed these steps.

mdadm --detail --scan >> /etc/mdadm.conf //configuration
mdadm --assemble --scan //assembly
1 Like

Ok, then where should I put it then? That could be it

I’d create a sub directory for it under /mnt, say /mnt/flex/, mount it there and use hard links if I need to reference it elsewhere, like in your $HOME DIRECTORY.

mkdir -p /mnt/filex Or without the P flag?

If you’re going to format the drives anyway, then you’ll be better off with btrfs RAID 0 or 1 than with mdadm.

2 Likes

The -p flag just tells mkdir to create any non-existing parent directories. So in this case, it won’t make any difference.

1 Like

You RAID0 - that implies you don’t care about data security but only go the performance.

So when security is not an issue - the added space is neither - therefore you could create a mdraid of the type RAID10,far2 which according to RAID - ArchWiki is on par with RAID0 but with redundacay.

I am using this on a old Lenovo Thinkstation using PCI card with 4 disks - it is fast and most important - it creates data redundancy.

Feel free to use my notes

Worth mentioning is also that RAID 10 can survive a double drive failure under certain circumstances.

So for my case, you are saying this steps?

mdadm --create --verbose --level=10 --metadata=1.2 --chunk=512 --raid-devices=2 --layout=f2 /dev/md/0 /dev/sdb1 /dev/sdd1

cat /proc/mdstat

mdadm --detail --scan >> /etc/mdadm.conf

mdadm --assemble --scan

You cannot sensibly create a RAID 10 with only two drives. You need four of them at least.

Two drives will give you RAID 0 or RAID 1.

In fact you can - because mdraid is different than what is commonly know as RAID10.

I did create two raid 10,far2 on that system.

I also tried the 4 disk version but there was no advantage other than the doubled diskspace.

something like that - I made notes - because I can never remember the details :slight_smile:

mdadm --create --verbose --level=10 --metadata=1.2 --chunk=512 --raid-devices=2 --layout=f2 /dev/md/${name} /dev/${partition} /dev/${partition}
cat /proc/mdstat
mdadm --detail --scan >> /etc/mdadm.conf
mdadm --assemble --scan

my notes on formatting the a two disk 10,far2

mkfs.ext4 -v -L ${name} -b 4096 -E stride=128,stripe-width=256 /dev/md/${name}

I have since begun using xfs (a Fedora base server)

mkfs.xfs -f -L ${name} -d su=2048k,sw=1 /dev/md/${name}
1 Like