raids
This commit is contained in:
parent
2722134a0f
commit
6603c88198
2 changed files with 20 additions and 32 deletions
32
bash/fs.sh
32
bash/fs.sh
|
@ -56,6 +56,22 @@ fs_make_fat() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fs_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
|
||||||
|
}
|
||||||
|
|
||||||
fs_wipe() {
|
fs_wipe() {
|
||||||
local device="${1}"
|
local device="${1}"
|
||||||
local buffer="${2}"
|
local buffer="${2}"
|
||||||
|
@ -103,19 +119,3 @@ luks_format() {
|
||||||
cryptsetup "${@}" luksFormat "${device}"
|
cryptsetup "${@}" luksFormat "${device}"
|
||||||
fi
|
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
|
|
||||||
}
|
|
||||||
|
|
|
@ -65,14 +65,8 @@ rescue_wipe_0_init_hetzner_8_8() {
|
||||||
for device in "${@}"; do
|
for device in "${@}"; do
|
||||||
members+=("${device}2")
|
members+=("${device}2")
|
||||||
done
|
done
|
||||||
mdadm \
|
fs_raid_create \
|
||||||
--create "/dev/md/boot" \
|
"boot" "00000000:00000000:00000000:00000002" "${members[@]}"
|
||||||
--level 0 \
|
|
||||||
--metadata 1 \
|
|
||||||
--name "md:boot" \
|
|
||||||
--raid-devices ${#} \
|
|
||||||
--uuid "00000000:00000000:00000000:00000002" \
|
|
||||||
"${members[@]}"
|
|
||||||
#
|
#
|
||||||
fs_make_btrfs "/dev/md/boot" "boot" \
|
fs_make_btrfs "/dev/md/boot" "boot" \
|
||||||
"00000000-0000-0000-0000-00000000000b"
|
"00000000-0000-0000-0000-00000000000b"
|
||||||
|
@ -95,14 +89,8 @@ rescue_wipe_0_init_hetzner_8_8() {
|
||||||
for device in "${@}"; do
|
for device in "${@}"; do
|
||||||
members+=("${device}1")
|
members+=("${device}1")
|
||||||
done
|
done
|
||||||
mdadm \
|
fs_raid_create \
|
||||||
--create "/dev/md/crypt" \
|
"crypt" "00000000:00000000:00000000:00000001" "${members[@]}"
|
||||||
--level 0 \
|
|
||||||
--metadata 1 \
|
|
||||||
--name "md:crypt" \
|
|
||||||
--raid-devices ${#} \
|
|
||||||
--uuid "00000000:00000000:00000000:00000001" \
|
|
||||||
"${members[@]}"
|
|
||||||
# encrypt
|
# encrypt
|
||||||
luks_format "${passphrase}" "/dev/md/crypt"
|
luks_format "${passphrase}" "/dev/md/crypt"
|
||||||
# open
|
# open
|
||||||
|
|
Loading…
Reference in a new issue