Setting up HARDWARE RAID with QUAD SATA-HAT (jms561 controller)

Hi there.

After several months of experiments with software RAID with mdadm using RPi 4 and SATA HAT, i has concluded, that it is not usable in this setup. RPi4 just do not have enough performance / memory / bus speed to get all speed benefits from RAID0/RAID1. I’m seeing hard memory cache (disk write/read cache) and CPU (software RAID, remember?) usage during usual rsync between two RAID0 arrays (4 disks), and speed spikes from 4mb/s to 80mbs, with average 20-30mb/s.

But our jms561 SATA-USB controllers, soldered on sata hat board, DO have hardware RAID capabilities. I have no idea why it is not used by default by Radxa engineers.

So we will try to enable it manually…

DISCLAIMER: EVERY STEP DESCRIBED BELOW THIS LINE, MAY CAUSE FULL DATA LOSS ON YOUR ATTACHED HDD’S, OR EVEN MAY BRICK YOUR SATA-HAT BOARD, DO IT ON YOUR OWN RISK, AND MAKE BACKUPS

First of all, we should update jms561 firmware, as described here:

Wget jms56x raid controller console app:

sudo wget https://wiki.odroid.com/_media/accessory/add-on_boards/xu4_cloudshell2/raidmgr_static_cloudshell2.zip
sudo unzip raidmgr_static_cloudshell2.zip
sudo chmod +x raidmgr_static

Start raid manager with SUDO:
sudo ./raidmgr_static

“Enter” will give you available command set:

Do be sure, try to find jms561 on you system with command GC:

If it shows 2 controllers, than 99% that everything goes fine.
First jms561 controls SATA1 and SATA3 port, second one respectively controls SATA2 and SATA4 ports.

This can be determined also with command DC C0 and DC C1, this will shows attached HDDs to jms 0 and jms1.

So now, we just need to create RAID0 with attached HDDs with command CR C0 D0,1 R0
This will create RAID0 on first jms561, with hdd0 and hdd1.

That’s it. Now we will see only one hdd in raspbian with doubled size:


There i have software RAID0 created with mdadm (sda,sdb) and hardware RAID0 created with raid manager.

Difference between software and hardware raid is fabulous, no mem cache and cpu usage, 120mb/s stable read speed, and 80mb/s stable write speed.

4 Likes

Nice one mate!
Great tutorial!
Good to see how we can use the hardware RAID (and it’s working).

My question is: do you think I can create a hardware RAID from software RAID without data loss, or should I copy all of my data to another HDD and copy them back after I created the hardware RAID?

Thanks, this discovery gives my RPi NAS a second breath.

About your question. I’m pretty sure it is not possible, or at least there is no standard way or algorithm to do this. So backing up and restoring is the Jedi way.

Hello,

Is it a good idea to create a RAID0 hardware on each jms561, then a RAID0 software to see only one disk? Or JBOD instead of RAID0?

Hi.

I think the only chance to find out is to experiment. JBOD mode can produce 2 or 1 logical disk, it is implementation defined.

Hi

Are you checked Penta HAT with Rock Pi 4 for the same config? I am waiting now for set arrival to my desk with target to do /hardware/ RAID NAS.

Eugenius.

Hi, im pretty sure this will NOT work, cause rockpi hat is in use of internal soc’s PCIe lines, and contains totally different pci-sata-pci JMicron controller. But no, i did not test this by myself, as i do not have rockpi.

Thanks! I hope it will not to be slow and overloaded.
Anyway, I’ll report my experience there a bit late: it seems it will not took much time for connecting, installing and testing.

Your’s
Eugenius.

Hi,

In the case of a fault disk, how I will receive the alert or see the warning?

Hi, led indicators in front of sata-hat case are still useful for several kinds of hdd hardware errors. Also, raid-manager have DC C{N} and SR C{N} command that will return controller and raid states. You can use awk parsing and a bit of bash scripting to get this field from raid-manager in automatic manner. And i think thats all you can use to register raid errors in hardware setup. Of-course, MDAMD is more verbose and more user friendly in this case.

1 Like

And what about a SATA HAT hardware faluire?
I think I have to buy a new SATA HAT to access my data.

Yep, like with any other hardware raid solution failure.

1 Like

Hi all,

Done in my RP PI 4b [ raid1 ]

i will probably weigh in that in order to revive data in the event of hardware failure (ie, piNAS dies), you can only retrieve your data with another JMS561 controller…

the benefits of software raid is compatibility… hardware dies, you can plug the disks into another linux system and retrieve your data…

so if ur using this as a longer term backup option, go with software raid… performance is not critical… if you use it as an active network disk, then hardware raid might be better…

Umm, why would the data be not retrievable? RAID 1 is easy, just connect one of the disks to a normal SATA adapter. With RAID 0 you’d need the striping parameters, then you can tell mdadm to assemble the disk in software.

So the hardware RAID1 just doing similar like a simple EXT4 partition HDD?
Just doing every modification on the both HDD?
Nothing hardware specific related thing?

I haven’t done this before (hardware RAID1).
Somebody should try it out.

Create a hardware RAID1, copy some files to the HDDs, and connect one of the HDD to eg. a PC and check what we can see.

RAID 1 is by definition mirroring identical data to two disks.

Some controllers shift the whole data to the end so they can write their own special header, block sync state and whatnot to it, but a better idea is to do that kind of thing at the end of the disk.

1 Like

That is really good information!

For my understanding:
To switch from software RAID to Hardware RAID, the software RAID must first be deleted. Then i can create the first RAID0 with CR C0 D0,1 R0 and with CR C1 D1,1 R0 the second RAID0. Is it still possible to create a RAID10 from both RAID0?

You can create RAID1 software from your two RAID0 hardware arrays. This will be close enougth to software RAID10 logic.