Is there a way to automatically detect new drive blocks and add them to a RAID?

2

I'm working on a small project that needs to be able to detect any number of newly added drives that have not been mounted, format them, and add an fstab entry to automatically mount them on startup, but all the drives should be mounted as a RAID type so they function as a single drive.

I know I can see the block locations (ie: /dev/sd?) using lsblk, but I need to be able to detect the drives without operator intervention, as the script will be run by people who don't know how to do this.

Is there a way to do this? Maybe by filtering by drives that don't have a mountpoint? I just don't know if that's the best method because what if there's another drive attached that isn't mounted but isn't one of the drives that should be included as part of this?

Darin Beaudreau

Posted 2019-03-12T17:40:24.397

Reputation: 121

Very interesting question. Are you using MDADM then? – Eric F – 2019-03-12T19:20:27.237

I'm not familiar with that tool, but as the man page says it's related to RAID, my question was also asking how to setup the RAID array. Sorry if that wasn't clear. – Darin Beaudreau – 2019-03-12T19:39:34.840

Ah sorry MDADM is the tool many people on linux use to create a software RAID – Eric F – 2019-03-12T20:05:00.593

No answers