From 094cef40357ce61cfe034dc25fed51060b656527 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 24 Jan 2014 18:25:48 +0100 Subject: Show a progress bar when creating RAID arrays. --- include/partition.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'include') 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 +# Copyright © 2013,2014 Guilhem Moulin # # 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. -- cgit v1.2.3