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
|
||||
}
|
||||
|
||||
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() {
|
||||
local device="${1}"
|
||||
local buffer="${2}"
|
||||
|
@ -103,19 +119,3 @@ 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
|
||||
}
|
||||
|
|
|
@ -65,14 +65,8 @@ rescue_wipe_0_init_hetzner_8_8() {
|
|||
for device in "${@}"; do
|
||||
members+=("${device}2")
|
||||
done
|
||||
mdadm \
|
||||
--create "/dev/md/boot" \
|
||||
--level 0 \
|
||||
--metadata 1 \
|
||||
--name "md:boot" \
|
||||
--raid-devices ${#} \
|
||||
--uuid "00000000:00000000:00000000:00000002" \
|
||||
"${members[@]}"
|
||||
fs_raid_create \
|
||||
"boot" "00000000:00000000:00000000:00000002" "${members[@]}"
|
||||
#
|
||||
fs_make_btrfs "/dev/md/boot" "boot" \
|
||||
"00000000-0000-0000-0000-00000000000b"
|
||||
|
@ -95,14 +89,8 @@ rescue_wipe_0_init_hetzner_8_8() {
|
|||
for device in "${@}"; do
|
||||
members+=("${device}1")
|
||||
done
|
||||
mdadm \
|
||||
--create "/dev/md/crypt" \
|
||||
--level 0 \
|
||||
--metadata 1 \
|
||||
--name "md:crypt" \
|
||||
--raid-devices ${#} \
|
||||
--uuid "00000000:00000000:00000000:00000001" \
|
||||
"${members[@]}"
|
||||
fs_raid_create \
|
||||
"crypt" "00000000:00000000:00000000:00000001" "${members[@]}"
|
||||
# encrypt
|
||||
luks_format "${passphrase}" "/dev/md/crypt"
|
||||
# open
|
||||
|
|
Loading…
Reference in a new issue