diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2014-01-24 18:25:48 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2015-06-07 04:28:01 +0200 |
commit | 094cef40357ce61cfe034dc25fed51060b656527 (patch) | |
tree | cb7144650e11401c0c9c7e319560249dbc899c0d /include | |
parent | a6a742628b560f9d5097008940547391831762c0 (diff) |
Show a progress bar when creating RAID arrays.
Diffstat (limited to 'include')
-rwxr-xr-x | include/partition.sh | 26 |
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. |