How to add a RAID? modprobe FATAL error

When trying to add a raid with mdadm, it gives the following error:

mdadm -C /dev/md0 -l raid1 -n=2 /dev/sd[ab]1

modprobe: FATAL: Module md_mod not found in directory /lib/modules/4.9.253-tegra
mdadm: Fail create md0 when using /sys/module/md_mod/parameters/new_array

How would I go about setting up a RAID? And why does it give this error, when mdadm is installed?
I have tried the exact same setup on a Raspberry Pi where everything worked as intended, so it must be some issue with the Image for the Jetson.

Hardware:
Jetson Nano B01 dev kit

Software:
jetson-nano-jp461-sd-card-image
mdadm version (4.1~rc1-3~ubuntu18.04.4)

Please refer to below thread to see if can gain some ideas to fix the problem: Creating RAID 10 with 4 USB devices - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums

Hi all

This ticket is closed since 15.10.2021.

So I mean, gain some ideas to fix which problem?

Best regards,
Marco

What this means is you are missing the kernel driver, and it is looking for it in the form of a module. You just need to add that kernel module(s). What do you see from:
zcat /proc/config.gz | grep 'CONFIG_MD'

I’m not positive of which modules are needed, although I think CONFIG_MD (and possibly CONFIG_MDIO) would be it. If it is “y”, then it is integrated and already there. If it is “m”, then it is a module and needs to be loaded. If it is “n”, then it is missing. This is generally a “Linux thing” and not specific to a Jetson, although with kernel modules and builds you want to follow the Jetson instructions.

Below is the response to

> CONFIG_MD=y
> CONFIG_MDIO=y
> # CONFIG_MDIO_BCM_UNIMAC is not set
> CONFIG_MDIO_BITBANG=y
> # CONFIG_MDIO_BUS_MUX_GPIO is not set
> # CONFIG_MDIO_BUS_MUX_MMIOREG is not set
> CONFIG_MDIO_CAVIUM=m
> # CONFIG_MDIO_GPIO is not set
> # CONFIG_MDIO_HISI_FEMAC is not set
> # CONFIG_MDIO_OCTEON is not set
> CONFIG_MDIO_THUNDER=m

It appears that both config_md and confid_mdio are already installed.

In that case perhaps it is a mistake that it wants a module format. Not sure. What do you see from:
find /lib/modules/$(uname -r)/kernel/drivers/md -iname '*'
zcat /proc/config.gz | egrep 'RAID[0-9]+'

I only notice a RAID6 file on a 4.x kernel of a TX2, but see different RAID features on a 5.x kernel. I’m curious which modules are present, and which features are present. I’m not positive of which features are required, but I would not be surprised if several are required for (A) md and (B) lvm2. Incidentally, you might also see if you have "lvm2: “dpkg -l | grep ‘lvm2’`”.

The thread @Kayccc mentioned is a good place to look even if it is old because it has a sample specifically on a Jetson with a 4.x kernel (which Nanos have).