aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/partition.sh26
1 files changed, 10 insertions, 16 deletions
diff --git a/include/partition.sh b/include/partition.sh
index 1d5b4c3..d487b02 100755
--- a/include/partition.sh
+++ b/include/partition.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Simple partitioning shell script.
-# Copyright © 2013 Guilhem Moulin <guilhem@fripost.org>
+# Copyright © 2013,2014 Guilhem Moulin <guilhem@fripost.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,8 +22,8 @@ set -ue
#device=/dev/sda
device='/dev/sda /dev/sdb' # space-separated form mutiple disks (raid)
-raidLevel=1 # raid level (leave empty for no raid)
-raidActiveDev=2 # number active devices in the array
+raidLevel=raid1 # raid level (leave empty for no raid)
+raidNumActiveDevices=2 # number of active devices in the array
n=0
@@ -90,24 +90,18 @@ for d in $device; do
done
# Create an array on top of that
-if [ ${raidLevel:-} -a ${raidActiveDev:-} ]; then
+if [ ${raidLevel:-} ]; then
[ -d /dev/md ] || mkdir /dev/md
- /sbin/modprobe -v md_mod
- [ -e /proc/mdstat ] || fail "/proc/mdstat missing"
- log "Creating RAID device /dev/md/boot with $part_boot"
- mdadm --create /dev/md/boot \
- -f -R -l raid$raidLevel -n $raidActiveDev \
- $part_boot
+ devices="$part_boot"
part_boot=/dev/md/boot
- wait_for_device $part_boot
+ fripost_mdadm_create "$part_boot" -f -R -l $raidLevel \
+ ${raidNumActiveDevices:+-n $raidNumActiveDevices} $devices
- log "Creating RAID device /dev/md/system with $part_system"
- mdadm --create /dev/md/system \
- -f -R -l raid$raidLevel -n $raidActiveDev \
- $part_system
+ devices="$part_system"
part_system=/dev/md/system
- wait_for_device $part_system
+ fripost_mdadm_create "$part_system" -f -R -l $raidLevel \
+ ${raidNumActiveDevices:+-n $raidNumActiveDevices} $devices
# They were only meant to preserve alignment accross physical
# devices.