From 2722134a0f7beda608b211efec7b76c23203b44c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 14:24:58 +0100 Subject: [PATCH] raid_create --- bash/fs.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bash/fs.sh b/bash/fs.sh index 05ac088..005a56d 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -103,3 +103,19 @@ luks_format() { cryptsetup "${@}" luksFormat "${device}" fi } + +raid_create() { + if [ -n "${4}" ]; then + local name="${1}" + local uuid="${2}" + shift 2 + mdadm \ + --create "/dev/md/${name}" \ + --level 0 \ + --metadata 1 \ + --name "md:${name}" \ + --raid-devices ${#} \ + --uuid "${uuid}" \ + "${@}" + fi +}